History log of /haiku/src/apps/terminal/TerminalBuffer.cpp
Revision Date Author Comments
# 7a772a55 08-Jan-2023 Jessica Hamilton <jessica.l.hamilton@gmail.com>

Terminal: support bracketed paste.

Fixes #18029: Pasting into nano etc. eats newlines and indentation

Change-Id: I935696bb97f4d82b30f73cc488f6317cf847beae
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5987
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# c0b591c5 10-Apr-2022 Jessica Hamilton <jessica.l.hamilton@gmail.com>

Terminal: implement 24-bit colour.

* Changes `TERM` to `xterm`, as we're now a full colour capable terminal
* Removes now-obsolete GuessPaletteColor from an RGB triple
* Since it's using a struct instead of uint32 for attributes, add a bunch
of helpers for a cleaner implementation
* Pass the TerminalBuffer's palette to the foreground/background get
helpers, for when an indexed colour is returned

Change-Id: I33bd3bb1407b87a237a8bc355093fe549e05b43a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5195
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# f78b75b1 05-Nov-2021 Jérôme Duval <jerome.duval@gmail.com>

Terminal: handle color queries

this allows apps like vim to select a color scheme based on a dark or light background.

Change-Id: Ia9f98d2373523a8b5fa379225a1c906ae075edf7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4693
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# e3c74f40 15-Oct-2019 Lukasz Towarek <lukasz.towarek@gmail.com>

Terminal: Add support for extended mouse coordinates

Fixes #11949

Change-Id: I779d1a9af2e3208ba3c055692de5e62b6a7b72fc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1919
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>


# 7ddb9624 21-Sep-2019 Murai Takashi <tmurai01@gmail.com>

Terminal: Fix mismatching malloc/delete

fAlternateScreen is allocated by malloc() in
BasicTerminalBuffer::_AllocateLines(), but freed by delete.
Pointed out by LGTM.

Change-Id: I526ecd7e570caf7d5ed90c715bbbfaf40e7e4be6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1882
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>


# 8840b3db 14-Aug-2019 Simon South <simon@simonsouth.net>

Terminal: Allow use of Option as Meta key

Add a configuration setting that allows the left Option key to be used as a
Meta key, and add support for the Escape sequences that control the Meta key's
behaviour.

TermWindow now maintains a copy, shared by all its component TermViews, of the
current key map, and updates this copy automatically when notified by the Input
Server a new key map has been loaded.

The Meta key was an extra modifier key present on early UNIX workstations that
provided access to the "extended" portion of the ASCII character set. Although
it has vanished from modern keyboards certain UNIX software still relies on the
key, most notably GNU Emacs and the GNU readline library, the latter of which
is used by bash and a wide variety of other software that reads input from a
terminal. (Python's interactive mode uses readline, for instance.)

With this patch applied and the new setting enabled, the left Option key can be
used to access additional editing and navigation features at the command line.
It also makes usable the port of GNU Emacs currently available from HaikuDepot.

Fixes #15294.

Change-Id: I150b640b7b18384d56ab2fb017bf16ce8bdbdd78
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1727
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 565155af 27-Jul-2019 Augustin Cavalier <waddlesplash@gmail.com>

Remove unnecessary usages of BLocker::Sem().

Most of these should have been BLocker::InitCheck() anyway.
The one that was actually using the sem (MessageLooper)
should just store the name parameter, which simplifies
things anyway.

Done as a result of a branch where I'm experimenting
with making BLocker not even create a semaphore in
"benaphore" mode.


# 85477b78 20-Oct-2018 Murai Takashi <tmurai01@gmail.com>

Terminal: Fix -Wtautological-constant-out-of-range-compare

Since index's type is uint8 (range 0-255) and kTermColorCount set to 256
(declared in terminal/Colors.h at line 31), 'index < kTermColorCount' is
always true.
Pointed out by clang.

Change-Id: I49e45cbd8a55223177fd2d6a64a0e37cf6341fc7
Reviewed-on: https://review.haiku-os.org/637
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# e998f2e4 18-May-2018 Murai Takashi <tmurai01@gmail.com>

Terminal: Fix -Werror=class-memaccess

Fix -Werror=class-memaccess pointed out by gcc8.
* Use TerminalLine::Clear() instead of memset()
* Use rgb_color::operator=() instead of memcpy()

Change-Id: I41360e245fd55c526d9c2802a2f247ba22583080
Reviewed-on: https://review.haiku-os.org/483
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# 1dd3b537 16-Mar-2013 Siarzhuk Zharski <zharik@gmx.li>

Fix Alternate/Normal screen's current attributes handling

Handle the current attributes of the TextBuffer consistently with other
Alt/Normal buffer sensitive variables. That fixes, for example, issues
with wrong background coloring of new lines in normal text buffer after
maximizing the terminal window running applications (like MC) performing
output onto alternate screen.


# 5b41331f 09-Mar-2013 Siarzhuk Zharski <zharik@gmx.li>

CodeStyle fixes, some refactoring and cleanup

* Clear some codestyle issues catched by checker script;
* Rename RestartDebugCapture to more consistent StartStopDebugCapture;
* Updated Copyrights and authors lists, some occurences of the raw MIT
licence text replaced with "under the terms of MIT licence" reference;
* Fixes for x86_64 build.

This is cumulative cleanup commit for series of Terminal refactoring
changes I have introduced last time. No significant functional changes.


# fe256869 08-Mar-2013 Siarzhuk Zharski <zharik@gmx.li>

Move colors table from TermView to TerminalBuffer

* ColorsTable moved to TerminalBuffer to let easy lookup of table
during parsing of control sequences;
* Default Palette initialized from now in TermApp and preserved
from modifying by applications;


# 6d30b376 05-Mar-2013 Siarzhuk Zharski <zharik@gmx.li>

Support for underline and ibeam terminal cursor styles

* Add support for underline and i-beam cursor shapes. No corresponding
UI configuration in preferences view ATM because preferences are waiting
for refactoring and we need some eggs for this Easters. ;-)
* Add handling of VT520/xterm specific DECSCUSR control sequences
allowing applications to modify the style and blinking state of the
cursor. May be utilized, for example, by console version of vim;
* Implement cursor blinking/hiding on DECSET/DECRST commands.


# 68ea9ce5 27-Jan-2013 Siarzhuk Zharski <zharik@gmx.li>

OSC and color management improoved

* Global kTermColorTable replaced with it's private copy for every
TermView instance. This allows to modify colors table for every view
separately;
* Set of ANSI normal/bright color entries added into preferences;
* Default color table generated dynamicaly using ANSI colors
preferences. 6x6x6 color cubes and grayscale ramp are generated in
xterm colors model;
* Improoved support of Operating System Command control sequences;
* Support for X11 rgb.txt compatible color names. Corresponding entries
are stored in hashed form in application resource and loaded only on
demand.


# 02f3baa0 26-Jan-2013 Siarzhuk Zharski <zharik@gmx.li>

Cleanup:Remove unused pref entries and fix typo

* PREF_SHELL is not used anymore, corresponding entry in /etc/passwd
should be used instead;
* PREF_GUI_LANGUAGE is not actual anymore - we have system-wide
UI localization support;
* Fix typo in the name of MSG_SET_TERMNAL_TITLE constant.


# f3782185 13-Nov-2011 Siarzhuk Zharski <zharik@gmx.li>

Refactoring of 8-bit encodings support.
* Fixed issue introduced in hrev38139: restoring from the line
drawing table was hard-coded to UTF8 Ground table. That is wrong:
the table for currently configured encoding must be set back.
Please look on using of _GuessGroundTable() for details;

* Fixed issue introduced in hrev34894: the semantic of convert_xx_utf8
functions requires the destination length to be set equal to the
target buffer size. Pre-hrev34894 usage of "homebrew" conversion
functions was a bit different - destination length was set to 0.
This made any converstions of input data useless and produce no
visual results;

* Private list of supported encodings (Encoding.cpp) was replaced by
using BPrivate::BCharacterSetRoster functionality. That allows to
use centralized info about encodings in unified with other
applications (Mail & StyledEdit for example) way. Most of currently
enumerated in UTF8.h encodings now available in Terminal.
Note that UCS-2 and UTF-16 are temporary (???) excluded from the
list of encodings supported by Terminal.

* The B_UTF16_CONVERSION was added in system-wide UTF8.h declarations.
This character set is available for enumerating by BCharacterSetRoster
but not listed in public API. Looks like it was just missed;

* Special note about "Text Encoding" entry in Preference File:
So known "shortname" of encoding was used in the preferences file.
For details look on the encodings list in previous version of
Encoding.cpp. As result of migrating to BCharacterSet-provided
resources this list was deleted and is not available anymore.
Instead of it the IANA name of the character encoding targeted
to be used for this purposes. Frankly speaking this part looks
like not working at the moment. The value of text encoding is
hardcoded to "UTF-8" now and is not affected by any operations
in Terminal menu. Note that "shortname" for default encoding
was "UTF8" but the saved value is "UTF-8" - and they are looking
not dependent at all. So this change should not introduce any
kind of backward incompatibility.


# 92d7fb19 21-Nov-2009 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Renamed "Coding" to "Encoding" and adjusted other files accordingly


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34175 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 11efbf01 24-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Applied patch by Olivier to implement more mouse reporting modes, and thus
fixing bug #2854. Thanks!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30374 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 21543141 19-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Applied slightly changed patch by Olivier that adds basic xterm style mouse
support, thanks!
* This probably closes bug #2854, confirmation pending.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30268 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1291c38c 19-Jun-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Implemented \ESC[?47h and \ESC[?47l (use alternative/normal screen
buffer). These are the sequences our /etc/termcap uses (local less and
vim use the alternative screen buffer now). The ones already implemented
are used e.g. by the termcap of my Linux installation. A bit weird all
those different termcap files, some even with the same version
number.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26031 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7f6f9ddb 17-Jun-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Forgot to clear the lines of the alternate screen buffer on
initialization. This would lead to crashes when resizing.
* Shuffled code in ResizeTo() a bit to make it more robust in case of
error (out of memory).



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26004 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d04aae8b 17-Jun-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Some preparations for DEC private mode settings support.
* Implemented alternate screen buffer support. Not used by any program
yet, since we still use the beterm termcap entry.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26003 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ecd79a2c 15-Jun-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Allow unsetting the listener. With multiple tabs there's only one
terminal view that is attached to the window and can receive messages at
all.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25964 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 23450280 09-Jun-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Pulled base class BasicTerminalBuffer out of TerminalBuffer. It contains
pretty much all the meaty code. Left in TerminalBuffer is only stuff
that didn't quite fit, like the encoding and view notifications.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25893 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5423f9c0 09-Jun-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Some renaming and inlining of TerminalBuffer methods.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25892 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cbe6d01c 09-Jun-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Propagate the encoding to TerminalBuffer. It doesn't really belong
there, but that's the easiest solution for the time being.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25887 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bdc33077 09-Jun-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

GCC 4 fixes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25885 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 52b1d543 09-Jun-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Terminal changes. This is still work in progress, some features
are disabled, lots of commented debug code is still in there,
and quite a bit of cleanup is needed, but basically things work
at least as well as before with several improvements:
* Changed TerminalBuffer from an interface to a complete
implementation. Removed all related code from TermView. Removed
the now obsolete TermBuffer. TermParse uses TerminalBuffer instead
of TermView, and TerminalBuffer asynchronously notifies TermView.
This avoids potential deadlocks, fixing #1918. It also speeds
up tty-output-bound programs. E.g. a "seq 10000" is about twice
at fast with the default terminal size in my setup, now. It's
still horribly slow compared to e.g. Konsole, though.
* Replaced CurPos by a more compact and fully inline class TermPos.
* Removed the offset feature (that insets the used text area) from
TermView, thus simplifying the code. Instead put the view into a
new parent view which provides the insets. This also fixes
artifacts that could sometimes be observed in the insets area.
* Scrolling related changes:
- When scrolling fully down, the (80x25 or whatever) terminal
screen is seen. It is not possible to scroll below the screen as
in Be's Terminal. Scrolling in Haiku's Terminal was weirdly
broken in this respect. As a side effect this fixes #2070.
- When not scrolled fully down, further output won't cause any
scrolling. It is thus possible to read earlier output while
something is still going on. Fixes #1772.
- Particularly to avoid unnecessary scrolling in the not scrolled
fully down case, TermView no longer actually scrolls. It only
sets an internal offset and manually uses CopyBits() as needed.
Introduced a (hacky) BScrollView subclass using a BScrollBar
subclass to make that possible.
* Selection related changes:
- Double/triple click plus dragging allows for selecting multiple
words/lines.
- Word selection no longer selects ranges of non-space characters.
Instead it knows that words are made of alpha numerical chars and
a certain set of other chars, and selects a range of commonly
classified characters (word chars, non-word non-whitespace chars,
whitespace chars). The non-alpha-num word characters should be
made user-settable. Due to missing multi-byte character
classification multi-byte whitespace is not recognized.
- Beyond the end of the line there no longer are invisible spaces.
Trying to select the region selects the end of the line (i.e.
line break). This is similar to how Konsole and xterm work.
- Added auto-scrolling when selecting with the mouse. Formerly the
Terminal scrolled only while moving the mouse. The scroll speed
might need some fine-tuning.
- Don't know what change exactly did that (likely the switch to
non-end-inclusive text ranges used internally), but the
occasional selection artifacts are gone.
* Resizing the terminal window re-wraps soft-wrapped lines.
* The find functionality seemed to be completely broken. At least it
never found anything for me. Should work now, though multi-byte
characters are not matched correctly in case-insensitive mode.

Regressions:
* Printing is disabled.
* Cursor blinking is disabled. Do we want it anyway?
* In several cases full-width characters are not handled correctly
(in more cases than before).
* Shrinking the terminal width doesn't work very well with "less"
(and probably other full-screen terminal apps), due to line
re-wrapping. "less" expects them to be truncated only. When
supporting an alternate screen buffer re-wrapping should be
disabled for it, which should solve the problem.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25881 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4386ce02 03-Jun-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Pulled the TermView interface used by TermParse into a new interface
class TerminalBuffer, which will evolve into a TermBuffer replacement
and decouple the parse thread from the window.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25787 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1dd3b537c3d9e3545d78c50cc26775174eec2051 16-Mar-2013 Siarzhuk Zharski <zharik@gmx.li>

Fix Alternate/Normal screen's current attributes handling

Handle the current attributes of the TextBuffer consistently with other
Alt/Normal buffer sensitive variables. That fixes, for example, issues
with wrong background coloring of new lines in normal text buffer after
maximizing the terminal window running applications (like MC) performing
output onto alternate screen.


# 5b41331f1100c78541d87b7ad5a15d5652acb079 09-Mar-2013 Siarzhuk Zharski <zharik@gmx.li>

CodeStyle fixes, some refactoring and cleanup

* Clear some codestyle issues catched by checker script;
* Rename RestartDebugCapture to more consistent StartStopDebugCapture;
* Updated Copyrights and authors lists, some occurences of the raw MIT
licence text replaced with "under the terms of MIT licence" reference;
* Fixes for x86_64 build.

This is cumulative cleanup commit for series of Terminal refactoring
changes I have introduced last time. No significant functional changes.


# fe256869783dc1598ee2d7d0c0b582e70724dc96 08-Mar-2013 Siarzhuk Zharski <zharik@gmx.li>

Move colors table from TermView to TerminalBuffer

* ColorsTable moved to TerminalBuffer to let easy lookup of table
during parsing of control sequences;
* Default Palette initialized from now in TermApp and preserved
from modifying by applications;


# 6d30b376e908fe678fc35c79d58314367f3d44fe 05-Mar-2013 Siarzhuk Zharski <zharik@gmx.li>

Support for underline and ibeam terminal cursor styles

* Add support for underline and i-beam cursor shapes. No corresponding
UI configuration in preferences view ATM because preferences are waiting
for refactoring and we need some eggs for this Easters. ;-)
* Add handling of VT520/xterm specific DECSCUSR control sequences
allowing applications to modify the style and blinking state of the
cursor. May be utilized, for example, by console version of vim;
* Implement cursor blinking/hiding on DECSET/DECRST commands.


# 68ea9ce5bbed50e08bf08a151477bbb0e1ac1227 27-Jan-2013 Siarzhuk Zharski <zharik@gmx.li>

OSC and color management improoved

* Global kTermColorTable replaced with it's private copy for every
TermView instance. This allows to modify colors table for every view
separately;
* Set of ANSI normal/bright color entries added into preferences;
* Default color table generated dynamicaly using ANSI colors
preferences. 6x6x6 color cubes and grayscale ramp are generated in
xterm colors model;
* Improoved support of Operating System Command control sequences;
* Support for X11 rgb.txt compatible color names. Corresponding entries
are stored in hashed form in application resource and loaded only on
demand.


# 02f3baa09d11547e1be4a950d279dd55371a3fcc 26-Jan-2013 Siarzhuk Zharski <zharik@gmx.li>

Cleanup:Remove unused pref entries and fix typo

* PREF_SHELL is not used anymore, corresponding entry in /etc/passwd
should be used instead;
* PREF_GUI_LANGUAGE is not actual anymore - we have system-wide
UI localization support;
* Fix typo in the name of MSG_SET_TERMNAL_TITLE constant.


# f37821851ef7dc4da35cd040329f11ca8cdd9826 13-Nov-2011 Siarzhuk Zharski <zharik@gmx.li>

Refactoring of 8-bit encodings support.
* Fixed issue introduced in hrev38139: restoring from the line
drawing table was hard-coded to UTF8 Ground table. That is wrong:
the table for currently configured encoding must be set back.
Please look on using of _GuessGroundTable() for details;

* Fixed issue introduced in hrev34894: the semantic of convert_xx_utf8
functions requires the destination length to be set equal to the
target buffer size. Pre-hrev34894 usage of "homebrew" conversion
functions was a bit different - destination length was set to 0.
This made any converstions of input data useless and produce no
visual results;

* Private list of supported encodings (Encoding.cpp) was replaced by
using BPrivate::BCharacterSetRoster functionality. That allows to
use centralized info about encodings in unified with other
applications (Mail & StyledEdit for example) way. Most of currently
enumerated in UTF8.h encodings now available in Terminal.
Note that UCS-2 and UTF-16 are temporary (???) excluded from the
list of encodings supported by Terminal.

* The B_UTF16_CONVERSION was added in system-wide UTF8.h declarations.
This character set is available for enumerating by BCharacterSetRoster
but not listed in public API. Looks like it was just missed;

* Special note about "Text Encoding" entry in Preference File:
So known "shortname" of encoding was used in the preferences file.
For details look on the encodings list in previous version of
Encoding.cpp. As result of migrating to BCharacterSet-provided
resources this list was deleted and is not available anymore.
Instead of it the IANA name of the character encoding targeted
to be used for this purposes. Frankly speaking this part looks
like not working at the moment. The value of text encoding is
hardcoded to "UTF-8" now and is not affected by any operations
in Terminal menu. Note that "shortname" for default encoding
was "UTF8" but the saved value is "UTF-8" - and they are looking
not dependent at all. So this change should not introduce any
kind of backward incompatibility.


# 92d7fb19f14435b56cf3722c2bcf6c8bc5ac1a13 21-Nov-2009 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Renamed "Coding" to "Encoding" and adjusted other files accordingly


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34175 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 11efbf01602654bfa8fb29b0681e90c2bb21f8c2 24-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Applied patch by Olivier to implement more mouse reporting modes, and thus
fixing bug #2854. Thanks!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30374 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 21543141ddb5ffd4a6f8e11254ca9015fef36a05 19-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Applied slightly changed patch by Olivier that adds basic xterm style mouse
support, thanks!
* This probably closes bug #2854, confirmation pending.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30268 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1291c38c181ac85064fb8e30ac533c03b45eb7d9 19-Jun-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Implemented \ESC[?47h and \ESC[?47l (use alternative/normal screen
buffer). These are the sequences our /etc/termcap uses (local less and
vim use the alternative screen buffer now). The ones already implemented
are used e.g. by the termcap of my Linux installation. A bit weird all
those different termcap files, some even with the same version
number.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26031 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7f6f9ddb94e6f1437ff19a4781d841c063cc04c5 17-Jun-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Forgot to clear the lines of the alternate screen buffer on
initialization. This would lead to crashes when resizing.
* Shuffled code in ResizeTo() a bit to make it more robust in case of
error (out of memory).



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26004 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d04aae8b80964ab6a3ab7725baf930d2320d4133 17-Jun-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Some preparations for DEC private mode settings support.
* Implemented alternate screen buffer support. Not used by any program
yet, since we still use the beterm termcap entry.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26003 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ecd79a2cc15697b7e1349f9963a6ab4b19564305 15-Jun-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Allow unsetting the listener. With multiple tabs there's only one
terminal view that is attached to the window and can receive messages at
all.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25964 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 234502808a662a88165c2fed4d3dcf382f59650d 09-Jun-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Pulled base class BasicTerminalBuffer out of TerminalBuffer. It contains
pretty much all the meaty code. Left in TerminalBuffer is only stuff
that didn't quite fit, like the encoding and view notifications.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25893 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5423f9c0accf4d0c1ded13b1de78573e873d084b 09-Jun-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Some renaming and inlining of TerminalBuffer methods.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25892 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cbe6d01c9d3f11497165d96b6904bc1d2d6417e2 09-Jun-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Propagate the encoding to TerminalBuffer. It doesn't really belong
there, but that's the easiest solution for the time being.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25887 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bdc33077f978c4fe10f2d2a4feb27d6709609faa 09-Jun-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

GCC 4 fixes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25885 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 52b1d543e80f5d48e6ef841fff4780c7c87bae11 09-Jun-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Terminal changes. This is still work in progress, some features
are disabled, lots of commented debug code is still in there,
and quite a bit of cleanup is needed, but basically things work
at least as well as before with several improvements:
* Changed TerminalBuffer from an interface to a complete
implementation. Removed all related code from TermView. Removed
the now obsolete TermBuffer. TermParse uses TerminalBuffer instead
of TermView, and TerminalBuffer asynchronously notifies TermView.
This avoids potential deadlocks, fixing #1918. It also speeds
up tty-output-bound programs. E.g. a "seq 10000" is about twice
at fast with the default terminal size in my setup, now. It's
still horribly slow compared to e.g. Konsole, though.
* Replaced CurPos by a more compact and fully inline class TermPos.
* Removed the offset feature (that insets the used text area) from
TermView, thus simplifying the code. Instead put the view into a
new parent view which provides the insets. This also fixes
artifacts that could sometimes be observed in the insets area.
* Scrolling related changes:
- When scrolling fully down, the (80x25 or whatever) terminal
screen is seen. It is not possible to scroll below the screen as
in Be's Terminal. Scrolling in Haiku's Terminal was weirdly
broken in this respect. As a side effect this fixes #2070.
- When not scrolled fully down, further output won't cause any
scrolling. It is thus possible to read earlier output while
something is still going on. Fixes #1772.
- Particularly to avoid unnecessary scrolling in the not scrolled
fully down case, TermView no longer actually scrolls. It only
sets an internal offset and manually uses CopyBits() as needed.
Introduced a (hacky) BScrollView subclass using a BScrollBar
subclass to make that possible.
* Selection related changes:
- Double/triple click plus dragging allows for selecting multiple
words/lines.
- Word selection no longer selects ranges of non-space characters.
Instead it knows that words are made of alpha numerical chars and
a certain set of other chars, and selects a range of commonly
classified characters (word chars, non-word non-whitespace chars,
whitespace chars). The non-alpha-num word characters should be
made user-settable. Due to missing multi-byte character
classification multi-byte whitespace is not recognized.
- Beyond the end of the line there no longer are invisible spaces.
Trying to select the region selects the end of the line (i.e.
line break). This is similar to how Konsole and xterm work.
- Added auto-scrolling when selecting with the mouse. Formerly the
Terminal scrolled only while moving the mouse. The scroll speed
might need some fine-tuning.
- Don't know what change exactly did that (likely the switch to
non-end-inclusive text ranges used internally), but the
occasional selection artifacts are gone.
* Resizing the terminal window re-wraps soft-wrapped lines.
* The find functionality seemed to be completely broken. At least it
never found anything for me. Should work now, though multi-byte
characters are not matched correctly in case-insensitive mode.

Regressions:
* Printing is disabled.
* Cursor blinking is disabled. Do we want it anyway?
* In several cases full-width characters are not handled correctly
(in more cases than before).
* Shrinking the terminal width doesn't work very well with "less"
(and probably other full-screen terminal apps), due to line
re-wrapping. "less" expects them to be truncated only. When
supporting an alternate screen buffer re-wrapping should be
disabled for it, which should solve the problem.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25881 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4386ce0206df74a06409dc1d5ebb0db3596c1e5c 03-Jun-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Pulled the TermView interface used by TermParse into a new interface
class TerminalBuffer, which will evolve into a TermBuffer replacement
and decouple the parse thread from the window.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25787 a95241bf-73f2-0310-859d-f6bbb57e9c96