haiku/src/apps/terminal/TermScrollView.cpp

66 lines
1.4 KiB
C++
Raw Normal View History

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
2008-06-09 21:04:26 +04:00
/*
* Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
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
2008-06-09 21:04:26 +04:00
// NOTE: Nasty hack to get access to BScrollView's private parts.
#include <ScrollBar.h>
#define private protected
#include <ScrollView.h>
#undef private
#include "TermScrollView.h"
#include <Message.h>
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
2008-06-09 21:04:26 +04:00
class TermScrollBar : public BScrollBar {
public:
TermScrollBar(BRect frame, const char *name, BView *target,
float min, float max, orientation direction)
:
BScrollBar(frame, name, target, min, max, direction)
{
}
virtual void ValueChanged(float newValue)
{
if (BView* target = Target())
target->ScrollTo(0, newValue);
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
2008-06-09 21:04:26 +04:00
}
};
TermScrollView::TermScrollView(const char* name, BView* child, BView* target,
bool overlapTop, uint32 resizingMode)
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
2008-06-09 21:04:26 +04:00
:
BScrollView(name, child, resizingMode, 0, false, true, B_NO_BORDER)
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
2008-06-09 21:04:26 +04:00
{
child->TargetedByScrollView(NULL);
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
2008-06-09 21:04:26 +04:00
// replace the vertical scroll bar with our own
if (fVerticalScrollBar != NULL) {
BRect frame(fVerticalScrollBar->Frame());
RemoveChild(fVerticalScrollBar);
delete fVerticalScrollBar;
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
2008-06-09 21:04:26 +04:00
// Overlap one pixel at the top (if required) with the menu for
// aesthetical reasons.
if (overlapTop)
frame.top--;
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
2008-06-09 21:04:26 +04:00
TermScrollBar* scrollBar = new TermScrollBar(frame, "_VSB_", target, 0,
1000, B_VERTICAL);
AddChild(scrollBar);
fVerticalScrollBar = scrollBar;
}
target->TargetedByScrollView(this);
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
2008-06-09 21:04:26 +04:00
}
TermScrollView::~TermScrollView()
{
}