Ticket #1480 (assigned enhancement)

Opened 15 years ago

Last modified 7 years ago

Home key behavior in editor

Reported by: dborca Owned by:
Priority: minor Milestone: Future Releases
Component: mcedit Version: 4.7.0-pre1
Keywords: Cc: dborca@…, szaszg@…
Blocked By: Blocking:
Branch state: on rework Votes for changeset:

Description

The following patch (against 4.7.0-pre1) makes the Home key go to the first column on first press, and then go to the beginning of non-whitespace -- if any.

Attachments

mc-4.7.0-pre1.home_key.patch.gz (352 bytes) - added by dborca 15 years ago.
mc-4.7.0-pre1.home_key.patch (666 bytes) - added by angel_il 15 years ago.
mc-4.8.3-4.home-end_key.patch (2.8 KB) - added by szaszg 12 years ago.
mc.1480.diff (5.7 KB) - added by szaszg 11 years ago.
New patch for master branch

Change History

Changed 15 years ago by dborca

comment:1 Changed 15 years ago by dborca

  • Cc dborca@… added

Changed 15 years ago by angel_il

comment:2 follow-up: ↓ 3 Changed 15 years ago by slavazanko

  • Milestone changed from 4.7.0-pre2 to 4.7.0-pre3

Nice, but IMO need to add config option for toggle this behaviour.
This feature-append go in pre3

comment:3 in reply to: ↑ 2 ; follow-up: ↓ 4 Changed 15 years ago by andrew_b

  • Priority changed from major to minor

Replying to slavazanko:

Nice, but IMO need to add config option for toggle this behaviour.

Definitely yes. I personally dislike such behavior.

comment:4 in reply to: ↑ 3 ; follow-up: ↓ 13 Changed 15 years ago by ossi

Replying to andrew_b:

Replying to slavazanko:

Nice, but IMO need to add config option for toggle this behaviour.

Definitely yes. I personally dislike such behavior.

this is exactly the type of micro option one should avoid at all costs.
you don't like it? get used to it, damn it. it's really not a big deal.

comment:5 Changed 15 years ago by angel_il

  • Owner set to angel_il
  • Status changed from new to accepted

comment:6 Changed 14 years ago by angel_il

  • Milestone changed from 4.7.0-pre3 to 4.7.0-pre5

comment:7 Changed 14 years ago by angel_il

  • Milestone changed from 4.7.0 to 4.7

comment:8 Changed 12 years ago by andrew_b

  • Branch state set to no branch
  • Milestone changed from 4.7 to Future Releases

Changed 12 years ago by szaszg

comment:9 Changed 12 years ago by szaszg

Here is a patch for the current HEAD.

It adds also a similar function to END key.

comment:10 Changed 12 years ago by angel_il

  • Cc szaszg@… added
  • Votes for changeset set to angel_il
  • Branch state changed from no branch to on review

look nice, thanx
branch: 1480_mcedit_home_end_enchencement
(parent: master)

my vote here

comment:11 Changed 12 years ago by andrew_b

  • Votes for changeset angel_il deleted
  • Branch state changed from on review to on rework

Don't unconditionally change common behavior. Please find a way to restore the previous one.

Changed 11 years ago by szaszg

New patch for master branch

comment:12 Changed 11 years ago by szaszg

I update the patch (for the master branch).

Now, by default HOME/END keys work as before. If user check Smart Home/End key behavior in options, or set option_smart_home_end to 1, Home/End keys work the new way (the Home key go to the first column on first press, and after second press go to the beginning of non-whitespace char and the End key go to the last column on first press, and after second press go to the end of non-whitespace char)

  1. edit.h
    • new variable declaration: option_smart_home_end - for new option
  2. editoptions.c
    • new option: Smart Home/End key behavior - to activate/deactivate new behavior
  3. edit.c
    • new variable: option_smart_home_end
    • new functions: edit_bol_var(), edit_eol_var() - to new behavior
  4. mcedit.1.in
    • new section about "option_smart_home_end" option

(Thanks to Ilia for the man page and option_smart_home_end :-)

comment:13 in reply to: ↑ 4 Changed 10 years ago by egmont

Replying to ossi:

Replying to andrew_b:

Replying to slavazanko:

Nice, but IMO need to add config option for toggle this behaviour.

Definitely yes. I personally dislike such behavior.

this is exactly the type of micro option one should avoid at all costs.
you don't like it? get used to it, damn it. it's really not a big deal.

My 2 cents here, in case anyone cares after 5 years :)

My favorite text editor "joe" implemented this feature at some point. As much as it irritated me and I didn't like it initially, I was lazy to dig up the config option to disable it (yes it can be disabled), and I got used to this feature quite quickly. I mean, I hardly ever press Home to get home when already at the first column (why would I?), but slowly began to use this every once in a while for its new functionality, so I find it more useful than annoying.

My vote goes for ossi's opinion: "get used to it, damn it."

comment:14 Changed 7 years ago by andrew_b

  • Owner angel_il deleted
  • Status changed from accepted to assigned
Note: See TracTickets for help on using tickets.