Bug 262090 - vt ignores the user-selected marking mode when moving mouse/extending mark
Summary: vt ignores the user-selected marking mode when moving mouse/extending mark
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: vt
Depends on:
Blocks: 262091
  Show dependency treegraph
 
Reported: 2022-02-21 10:07 UTC by Stefan B.
Modified: 2022-02-26 10:53 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan B. 2022-02-21 10:07:56 UTC
Let me explain:
Xorg has three marking modes:
-click+drag = character-wise marking: all characters from mousedown char to mouseup char
-double-click+drag = word-wise marking: all words from mousedown word to mouseup word
-triple-click+drag = line-wise marking: all lines from mousedown line to mouseup line

In vt there seems to be missing a variable/flag which registers the marking mode being chosen by the user.

When moving the mouse to extend the marked area, this results in mark_start and mark_end to work incorrectly in word and line mode, effectively nixing the word/line mark mode and entering the char mark mode.
Comment 1 Ed Maste freebsd_committer freebsd_triage 2022-02-22 21:01:06 UTC
Confirmed.

Note that vt_buf has some attempt at saving the marking mode already, see vb_mark_last in struct vt_buf. We'll need to store the marking mode rather than the (raw) last mouse event.
Comment 2 Ed Maste freebsd_committer freebsd_triage 2022-02-23 20:07:17 UTC
Based on xterm's behaviour, with VTB_MARK_MOVE the originally selected word or line remains selected as the cursor moves before/after the selection.

In VTB_MARK_EXTEND the selection is extended if the cursor is outside of the selection. If inside the selection text is unselected from the closer end. For example, consider this example, with the words in [] currently selected:

  one [two three four five six seven eight] nine ten

VTB_MARK_EXTEND on the word "four" would result in

  one two three [four five six seven eight] nine ten

while VTB_MARK_EXTEND on "seven" would result in

  one [two three four five six seven] eight nine ten

In contrast to VTB_MARK_MOVE the originally selected word or line will not necessarily remain selected.