Ticket #4175 (new enhancement)
[patch] CenterView action
Reported by: | psprint | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | Future Releases |
Component: | mcedit | Version: | master |
Keywords: | movement | Cc: | |
Blocked By: | Blocking: | ||
Branch state: | no branch | Votes for changeset: |
Description
Hi,
the patch adds CenterView? action to MCEdit which positions the display making the current line at center. It doesn't move cursor. See also this discussion.
Attachments
Change History
comment:1 Changed 4 years ago by psprint
I think that ticket system is more appropriate place for this question:
I would like to further extend the action in a way described on the list. However I see that the timer support that I've noticed (mc_timer_t) has been removed recently. Can I ask why?
comment:2 follow-up: ↓ 4 Changed 4 years ago by psprint
It turns out that mc_timer_t wasn't a timer, i.e.: it wasn't a timeout callback mechanism. Is there something like this in the source base? A mechanism, that would allow to:
– register a callback function to be invoked after specified pause,
– the callback should be invoked in the main thread, in idle time.
comment:3 Changed 4 years ago by ossi
for all i know, there isn't, and given the current architecture, it would be Hard (TM) to add it. but there is a long-standing todo item to migrate mc to the glib main loop, which would make glib timers available as well (obviously).
comment:4 in reply to: ↑ 2 Changed 4 years ago by andrew_b
About patch. You want to read the HACKING again, don't you? I'm really tied talk to you about simple things.
Replying to psprint:
It turns out that mc_timer_t wasn't a timer,
What timer you're talking about?
comment:5 Changed 4 years ago by psprint
Sorry about the style. I've had a correct patch prepared, however after I updated my script to automatically append .patch extension I didn't update the name and missed the new file.
I've left the commenting style as it is in other functions in edit.c.
comment:6 Changed 4 years ago by smartmic
As written in the mc gnome mailing list, I made an enhancement to the line centering functionality:
There is major difference in my patch however — and this is important for
my personal text editing experience: I mostly feel the need to center
the current line when I am already at the bottom of the buffer, eg.
editing long text or code and the cursor line is both on the bottom of
the window and the buffer. Therefore I made a hack to redraw the window
when I am in the bottom half of both window and buffer.
The attached patch 0001-My-squashed-CenterLine-commits.patch is related to this ticket.
— Martin
comment:7 Changed 4 years ago by psprint
The v3 patch:
- uses ctrl-alt-c instead of alt-shift-c for the action, as the alt-shift shortcut is better used by WindowCascade action (together with WindowTile action ↔ alt-shift-t),
- fixes mc.default.keymap – the binding was added in wrong section ([panel] instead of [editor]).
Replying to andrew_b:: I was talking about mc_timer_t judging from the name that it's a callback after timeout invocation mechanism, but I now see that it was just a timestamp obtaining utility.