Opened 12 years ago

Closed 11 years ago

#2854 closed enhancement (fixed)

[Terminal] midnight commander can't be controlled by a mouse

Reported by: diver Owned by: axeld
Priority: normal Milestone: R1
Component: Applications/Terminal Version: R1/pre-alpha1
Keywords: Cc:
Blocked By: Blocking:
Platform: All


Both konsole and gnome-terminal can control mc by a mouse, but our terminal don't.

Attachments (2)

terminal_r30246.diff (13.9 KB ) - added by oco 11 years ago.
Patch that add mouse support (xterm mode 1003 for now)
terminal_r30297.diff (7.9 KB ) - added by oco 11 years ago.
Patch that implement xterm mouse mode 9, 1000 and 1002

Download all attachments as: .zip

Change History (12)

comment:1 by bonefish, 12 years ago

Type: bugenhancement

That's just a missing feature. :-)

by oco, 11 years ago

Attachment: terminal_r30246.diff added

Patch that add mouse support (xterm mode 1003 for now)

comment:2 by oco, 11 years ago

Here is a patch that should help with this missing feature. At least, it is enough to have mouse support in the freepascal text mode IDE.

comment:3 by diver, 11 years ago

Great! Did you tried midnight commander? Just ssh to some unix box with mc installed.

comment:4 by oco, 11 years ago

No, i don't have this here. According to http://mc.redhat-club/svn/trunk/FAQ, you may need to invoke "mc -x"

comment:6 by axeld, 11 years ago

Owner: changed from jackburton to axeld
Status: newassigned

comment:7 by axeld, 11 years ago

Thanks oco, applied in hrev30268! There were a number of things to note about your, though:

  • The array size of the "destBuffer" was one byte too small.
  • Coding style requires upper caps to delimit variables, not underscores; xterm_x, xterm_buttons become xtermX, and xtermButtons.
  • Since we're using C++, it's preferred to declare variables when you need them, not at the beginning of a function.
  • If you only add a few lines, and need to indent the whole long rest of a function, it's often clearer if you return from your special case, and leave the rest of the code unchanged.
  • When you add a TODO comment, it's usually useful to write the comment directly next to the "TODO" so that when you grep for TODO, you will see at least part of the comment (to get an idea).

I'll keep this bug open until we have the confirmation it'll work with midnight commander.

comment:8 by oco, 11 years ago

After looking at, midnight commander user xterm mode 1000. A new patch will be needed.

by oco, 11 years ago

Attachment: terminal_r30297.diff added

Patch that implement xterm mouse mode 9, 1000 and 1002

comment:9 by oco, 11 years ago

Here is a new patch that implement 3 others xterm mouse mode : 9, 1000, 1002. Only mode 1000 was tested (the freepascal IDE could support it). The remaining mode 1001 (mouse highlight tracking) is not implemented. I have no plan to implement it as i don't fully understand how it should work.

comment:10 by axeld, 11 years ago

Resolution: fixed
Status: assignedclosed

Thanks, I've applied it in hrev30374.

I have some remarks again, though:

  • please don't use names like "Btn" - always prefer more descriptive names like "Button" in this case (I've already changed that in the patch). OTOH redundant long naming like SetReportX10Mouse(bool reportX10Mouse) should be avoided.
  • When having so many boolean flags, maybe a "uint32 fReportFlags" would be more appropriate; I haven't changed this, though.
  • please honour the 80 character per line limit.
Note: See TracTickets for help on using tickets.