History log of /haiku/src/apps/terminal/TermViewStates.cpp
Revision Date Author Comments
# 1ddf7e73 03-Mar-2024 Oscar Lesta <oscar.lesta@gmail.com>

Terminal: change some shortcuts again.

hrev57608 changes conflict with the use of left-option-as-meta (#18832).

Avoid that by using:

- CMD+left/right for switching tabs, and Shift+CMD+left/right for moving them.
- Ctrl+Shift+up/down for one-line-at-a-time scrolling.

Should fix #18832, but I'm still not happy with those scrolling shortcuts.

Also: removed some `(mod & B_COMMAND_KEY)` checks that don't make much sense
on `BView::KeyDown()`. They were there since hrev26038.

Change-Id: I8d276d18057d309b786f0480c27071cf084b38ef
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7495
Reviewed-by: humdinger humdinger <humdinger@mailbox.org>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# c9d1e840 24-Jan-2023 Oscar Lesta <oscar.lesta@gmail.com>

Terminal: try to fix SHIFT+{Arrow,Home,End} keys handling.

This allows programs running on Terminal to do things like select text using
SHIFT+arrows, and SHIFT+{Home,End} (tested with "mcedit" and "turbo" editors).

Moved Terminal's shortcut for:
- "Switch to nex/previous tab" to: B_OPTION_KEY+{left,right}.
- "Scroll Up/Down" to: B_OPTION_KEY+B_SHIFT_KEY+{Up,Down}

(B_OPTION_KEY+{Up,Down} seems to be captured elsewhere?)

References for the added escape sequences:

https://www.emacswiki.org/emacs/CuaModeTerminalProblems

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


# 8386ba27 06-Apr-2022 Jérôme Duval <jerome.duval@gmail.com>

Terminal: fixes motion events

* fReportButtonMouseEvent 1002 means only drag events are to be reported.
* only one of the modes 1000/1002/1003 can be selected.
* makes sure to report a button when dragging.
* secondary and tertiary buttons were reversed.
* extended buffer is now filled with snprintf.
* fixes #17684

Change-Id: I59d80937ae193343dc1e7006c4371320fc2182d7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5184
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 9a7f2c24 14-Jan-2022 Jérôme Duval <jerome.duval@gmail.com>

Terminal: add support for mouse press/release events in Extended/SGR 1006 mode

fixes #17532

Change-Id: Ic9f19ace5c728b6823caa5ce8ec35dc35d244220
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4867
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 8d763b7f 20-Jan-2020 Kyle Ambroff-Kao <kyle@ambroffkao.com>

Terminal: Fix crash for keystroke with unexpected modifiers

This patch fixes a segfault in Terminal that happens when you issue a
keystroke with unexpected modifiers. An easy way to repro this is:

1. Set command key to super
2. Set option key to meta in Terminal
3. Issue `ctrl+alt+shift+<key>`

In DefaultState::KeyDown(), the branch that handles option key as meta
detects that additional modifiers were used along with the meta key
and tries to look up the keymap associated with that combination of
modifier keys.

This lookup in TermView::fKeymapTableForModifierse can return NULL,
since TermView::SetKeymap() sets a pre-defined set of (modifier combo)
=> keymap entries.

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


# 75d2b89f 07-Sep-2019 Augustin Cavalier <waddlesplash@gmail.com>

Terminal: Fix GCC2 build.


# 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>


# 52100b0c 03-Aug-2015 Ingo Weinhold <ingo_weinhold@gmx.de>

Terminal: Support paths starting with '~' in hyperlink mode

Implements #12282.


# 7a214200 05-Jun-2014 John Scipione <jscipione@gmail.com>

Revert "TermViewStates: Check if fView is NULL before using it."

This reverts commit b84955c73892d942d2b53e7a992b63e774e52789.


# 4bf5fb92 05-Jun-2014 John Scipione <jscipione@gmail.com>

Revert "Fix #10902 Terminal crashes setting window size."

This reverts commit 4c8d2387169eb503e9a4a347645dd37c238d1c8a.


# 4c8d2387 05-Jun-2014 John Scipione <jscipione@gmail.com>

Fix #10902 Terminal crashes setting window size.

Terminal crashes because fView is not connected to App Server when
this is called so calling fView->GetMouse() is not allowed. We could
perhaps check to make sure that fView is connected to App Server by
checking that fView->Window() != NULL, but, a better way to handle this
is to grab the already set fLastClickPoint variable from fView
which eliminates the need to grab the current mouse position again.
Worst case scenario is that fLastClickPoint hasn't been set in which
case Terminal won't find anything to highlight or unhighlight.

Also check to make sure that fView != NULL here for good measure.

Fixes #10902


# b84955c7 05-Jun-2014 John Scipione <jscipione@gmail.com>

TermViewStates: Check if fView is NULL before using it.


# da80e3d9 05-Jun-2014 John Scipione <jscipione@gmail.com>

TermViewStates: Style fixes


# 78a1163c 12-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Terminal: hyper link mode: Try more aggressively to detect a path

Consider ':' a potential path delimiter and try all combinations of
chopped off prefixes and suffixes. This makes detection in the output
of a multi-file grep work even if the found line starts with a path
character or is a path. A path in the typical colon delimited search
paths (e.g. PATH) is detected as well.


# a15966b3 12-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Terminal: hyper link mode: handle relative paths better

* We were trying relative paths as is, which means checking them with
Terminal's current working directory. Now we use the CWD of the active
process.
* In case the path is relative, add a context menu item "Copy absolute
path".


# 7daf3758 12-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Terminal: HyperLink: Remove base address, add text property

* The base address is no longer used (it was in a an earlier, never
committed version), so we can as remove it.
* Introduce a text property.


# 7de99f83 10-May-2013 Rene Gollent <anevilyak@gmail.com>

Fix Terminal build.


# e9bad28a 10-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Terminal: Add a hyperlink mode

When holding down Command, text under the mouse is checked whether it
looks like a URL or a local path. If so, it is highlighted and can be
clicked, which will open the URL/file. Right-clicking opens a context
menu with items for opening the link/file or copying it to the
clipboard. When additionally holding down Shift, path prefixes up to
the component under the mouse will be considered (no effect for URLs).

Changes:
* Add HyperLink class. Encapsulates a type, the address, and an
optional base address. Features an Open() method to open the address.
* Move/add some string constants to TermConst.
* Move TermView::CharClassifier to top level and rename to
DefaultCharClassifier.
* Introduce TermViewHighlight and TermViewHighlighter. The former
refers to a range of text in a TermView's text buffer. It also
contains a pointer to a TermViewHighlighter object, which specifies
how the text range shall be rendered (colors and attributes).
* TermView:
- Add respective _{Add,Remove}Highlight() methods and adjust the code
to support highlights.
- Make the selection a TermViewHighlight. At least its visual aspect
is now handled like other highlights.
- Introduce an inner TextBufferSyncLocker. It is used instead of
BAutolock when locking the text buffer to synchronize the visual
buffer with it. After it unlocks it calls
_VisibleTextBufferChanged(), if the visual text buffer has changed,
which in turn calls a new callback on the active state.
- Add WindowActivated() and ModifiersChanged() callbacks to the state
interface.
- Add new states HyperLinkState and HyperLinkMenuState which
implement the new feature.

Fix modifier issues


# bda35ef5 09-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Terminal: Pull user input handling into state classes


# 52100b0c0e79c475267b510420f1f1da133005ca 03-Aug-2015 Ingo Weinhold <ingo_weinhold@gmx.de>

Terminal: Support paths starting with '~' in hyperlink mode

Implements #12282.


# 7a214200edb572c607d24ee57d3bc0e5766495bd 05-Jun-2014 John Scipione <jscipione@gmail.com>

Revert "TermViewStates: Check if fView is NULL before using it."

This reverts commit b84955c73892d942d2b53e7a992b63e774e52789.


# 4bf5fb92520ef0d519117343134a921baaa6e5b6 05-Jun-2014 John Scipione <jscipione@gmail.com>

Revert "Fix #10902 Terminal crashes setting window size."

This reverts commit 4c8d2387169eb503e9a4a347645dd37c238d1c8a.


# 4c8d2387169eb503e9a4a347645dd37c238d1c8a 05-Jun-2014 John Scipione <jscipione@gmail.com>

Fix #10902 Terminal crashes setting window size.

Terminal crashes because fView is not connected to App Server when
this is called so calling fView->GetMouse() is not allowed. We could
perhaps check to make sure that fView is connected to App Server by
checking that fView->Window() != NULL, but, a better way to handle this
is to grab the already set fLastClickPoint variable from fView
which eliminates the need to grab the current mouse position again.
Worst case scenario is that fLastClickPoint hasn't been set in which
case Terminal won't find anything to highlight or unhighlight.

Also check to make sure that fView != NULL here for good measure.

Fixes #10902


# b84955c73892d942d2b53e7a992b63e774e52789 05-Jun-2014 John Scipione <jscipione@gmail.com>

TermViewStates: Check if fView is NULL before using it.


# da80e3d9e2b633e19638e38797c9feffee24ac8b 05-Jun-2014 John Scipione <jscipione@gmail.com>

TermViewStates: Style fixes


# 78a1163c7b5d51d09f757f125ccd683bef0a06d9 12-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Terminal: hyper link mode: Try more aggressively to detect a path

Consider ':' a potential path delimiter and try all combinations of
chopped off prefixes and suffixes. This makes detection in the output
of a multi-file grep work even if the found line starts with a path
character or is a path. A path in the typical colon delimited search
paths (e.g. PATH) is detected as well.


# a15966b3b028d16da29c6b5b7efa43937b6dc7e6 12-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Terminal: hyper link mode: handle relative paths better

* We were trying relative paths as is, which means checking them with
Terminal's current working directory. Now we use the CWD of the active
process.
* In case the path is relative, add a context menu item "Copy absolute
path".


# 7daf375812ce3e9ee44b1d09d2c64f0d3ebbaa7c 12-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Terminal: HyperLink: Remove base address, add text property

* The base address is no longer used (it was in a an earlier, never
committed version), so we can as remove it.
* Introduce a text property.


# 7de99f83417fa30af420669e56f8cdb5342c3e61 10-May-2013 Rene Gollent <anevilyak@gmail.com>

Fix Terminal build.


# e9bad28aafc6b71378bb71139cde6269bbb0afa7 10-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Terminal: Add a hyperlink mode

When holding down Command, text under the mouse is checked whether it
looks like a URL or a local path. If so, it is highlighted and can be
clicked, which will open the URL/file. Right-clicking opens a context
menu with items for opening the link/file or copying it to the
clipboard. When additionally holding down Shift, path prefixes up to
the component under the mouse will be considered (no effect for URLs).

Changes:
* Add HyperLink class. Encapsulates a type, the address, and an
optional base address. Features an Open() method to open the address.
* Move/add some string constants to TermConst.
* Move TermView::CharClassifier to top level and rename to
DefaultCharClassifier.
* Introduce TermViewHighlight and TermViewHighlighter. The former
refers to a range of text in a TermView's text buffer. It also
contains a pointer to a TermViewHighlighter object, which specifies
how the text range shall be rendered (colors and attributes).
* TermView:
- Add respective _{Add,Remove}Highlight() methods and adjust the code
to support highlights.
- Make the selection a TermViewHighlight. At least its visual aspect
is now handled like other highlights.
- Introduce an inner TextBufferSyncLocker. It is used instead of
BAutolock when locking the text buffer to synchronize the visual
buffer with it. After it unlocks it calls
_VisibleTextBufferChanged(), if the visual text buffer has changed,
which in turn calls a new callback on the active state.
- Add WindowActivated() and ModifiersChanged() callbacks to the state
interface.
- Add new states HyperLinkState and HyperLinkMenuState which
implement the new feature.

Fix modifier issues


# bda35ef5dc71c1c4a4e831233f937bcb130bd284 09-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Terminal: Pull user input handling into state classes