Opened 13 years ago

Closed 13 years ago

Last modified 8 years ago

#906 closed enhancement (fixed)

[PATCH] Position cursor at end of line when browsing console history

Reported by: Ross Bearman Owned by:
Priority: Nice to Have Milestone: Alpha 7
Component: Core engine Keywords: patch
Cc: Patch:

Description

After a request from vtsj on IRC, I've patched CConsole to position the cursor at the end of the line when browsing up or down through history.

Currently if you type something and then press up or dow it will show all entries that start with that string; however if the cursor is then moved to the end of the line the next search up or down will search for that entire string. Therefore in order to implement the positioning of the cursor at the end of the line, the prefix search would have to be removed.

Common shells (Windows cmd, bash and others) don't use this kind of prefix searching, although zsh implements a separate functionality for searching through history.

After a short discussion with Phillip on IRC I decided to submit this patch and allow the developers to decide whether it's more intuitive/useful to have the cursor at the end of the line or the prefix searching.

Attachments (1)

cconsole_history_patch.patch (2.4 KB ) - added by Ross Bearman 13 years ago.
Patches CConsole to move the cursor to the end of the line on history searches, removes prefix searching.

Download all attachments as: .zip

Change History (11)

by Ross Bearman, 13 years ago

Patches CConsole to move the cursor to the end of the line on history searches, removes prefix searching.

comment:1 by vts, 13 years ago

Patch appears to work great! Much easier to quickly edit arguments now, and no more need to look closely to see where the cursor's at.

comment:2 by Ross Bearman, 13 years ago

Type: defectenhancement

comment:3 by historic_bruno, 13 years ago

Milestone: BacklogAlpha 7

comment:4 by Kieran P, 13 years ago

Keywords: patch added

comment:5 by Philip Taylor, 13 years ago

I don't think I've ever liked the prefix search thing, so I'll commit this to see if anyone complains :-)

(Made some trivial changes: fixed some trailing whitespace and missing space in "if (" (not that this code is very consistent about formatting in any case...))

comment:6 by philip, 13 years ago

Resolution: fixed
Status: newclosed

(In [9939]) Replace console prefix-search behaviour with more standard history navigation, based on patch by Ross Bearman. Fixes #906.

comment:7 by Ross Bearman, 13 years ago

I wasn't sure if it was appropriate for me to make changes to improve the formatting for the file as a whole and include them in this patch. Thoughts on that?

comment:8 by Philip Taylor, 13 years ago

If a patch is already changing some lines of code then I think it's good for it to change the formatting of those lines to be more consistent; but larger changes to formatting should probably be separate patches, without changing any functionality at the same time, so it's easy to verify they're not accidentally altering behaviour.

(Usually I don't personally care about formatting enough to spend effort improving it for its own sake, and only change it if I'm already having to read and modify that code, so the old code evolves towards consistency very slowly (but hopefully new code is more consistent). CConsole does look quite a bad case though, with internally-inconsistent style and with a static variable where surely a member variable would be appropriate...)

comment:9 by Ross Bearman, 13 years ago

Mm, that's generally my thinking; but as you pointed out CConsole is in quite a state. I may create a separate patch for general improvements to CConsole and see if there is anything else that could be useful while I'm at it.

comment:10 by sanderd17, 8 years ago

Keywords: review removed
Note: See TracTickets for help on using tickets.