Giter VIP home page Giter VIP logo

centered-cursor-mode.el's People

Contributors

andre-r avatar chrm avatar holocronweaver avatar loop54-christoffer avatar sir4ur0n avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

centered-cursor-mode.el's Issues

Bug with collapsed lines (eg. org-mode)

To reproduce:

  1. take a big org file
  2. collapse everything with S-Tab
  3. trigger the recenter animation, for example:
    3.1 scroll till you can see the last line, but are far enough away to trigger the recenter animation
    3.2 click with the mouse on the last line
    3.3 press the arrow up key
    3.4 Emacs freezes

The bug is somewhere in the recenter animation. A workaround is to disable the animation with (setq ccm-ignored-commands '()).

As far as I can tell the line (count-lines (window-start) (point)) doesn't produce the correct result when there are collapsed lines.

ccm-position-cursor relatively expensive for post-command-hook

I'm in the process of weeding out the causes of my input latency in Emacs, and one of the minor modes that do cause some slowdown on input, but which I cannot live without either, is centered cursor mode.

The documentation for post-command-hook suggests wrapping expensive computations in (while-no-input (redisplay) ...). This is not possible for functions that temporarily put Emacs in an undesirable state, but to my knowledge, ccm-position-cursor is written well enough to only ever improve the state of Emacs, meaning canceling it halfway through when we know it will execute soon enough again should be fine.

I am currently trying this out with the following piece of advice:

(define-advice ccm-position-cursor
    (:around (next) cancel-recentering-on-input)
  (while-no-input (redisplay) (funcall next)))

If I'm not alone in thinking this is sensible, then it might be worth wrapping the entire body of ccm-position-cursor to prevent individual users from having to advice it. I'll try to remember to report back with my experiences after running this for a while.

If you like it, I can submit a pull request. I just don't want to implement it properly until I've had a chance to try it out for a while.

Lock current cursor position

Is it possible to use the current vertical cursor position as the locked position when entering centered-cursor-mode?

doesn't work with multiple windows on the vertical axis

Given the windows A and B, where A is taller than B:

┌────────┐  
│ ****** │  <-- Cursor skewed towards the top
│   A    │  
│        │  
├────────┤  
│   B    │  
└────────┘  

The cursor rests on the ***** position, which is skewed towards the top rather than centered.
Expected behavior:

┌────────┐  
│        │  
│ ****** │  <-- Centered cursor on window A
│        │  
├────────┤  
│   B    │  
└────────┘  

This is on the dev branch

Update:

The bug happens with the previous window configuration and then opening a completion buffer (such as M-x with Ivy/Swiper/Helm/Counsel...)

Cursor Is Centered at the End of Compilation Buffers

In compilation buffers, the cursor will centered when there is new output that sends it past the end of the screen. This results in only half of the compilation buffer showing output at a given time. I have set scroll-conservatively to a large value and that seems to fix the issue.

Play nice with recenter-top-bottom

This is a cool package!

I'd love for recenter-top-bottom to work when this mode is enabled. Currently, if I run end-of-buffer to jump to the end of a buffer that's longer than one viewable page, the last line of the buffer is at the bottom of the window, with point on the last character of it.

I have recenter-positions defined as (0.33 top bottom), so when I run recenter-top-bottom, I'd expect the line that point is on to be placed 33% below the top of the window -- this is what happens if centered-cursor-mode is not activated. However, when it is activated, point and the line it is on stay pinned to the bottom of the window.

Void-variable mouse-wheel-up-alternate-event

Hey there,

Just wanted to give a heads up - it looks like #25 broke backward compatibility. I was reinstalling my packages today via MELPA in Emacs 28.2, and the package stopped working.

I tried searching for an alternative version in MELPA-stable, but it seems like we only have the MELPA one, right?

(No big deal for me, though. I can keep a local version without these last changes until my distro updates Emacs to 29.1. Just wanted to let you guys know in case someone else runs into the same issue.)

Support Emacs 29.1 alternate mouse scroll events

Hello,

Apparently 2 new variables have been added in Emacs 29.1:

However centered-cursor-mode does not yet support them, and I found out the hard way 😭

It seems that in Emacs 29.1:

  • in GUI, it sends the alternate event (e.g. mouse-wheel-down-alternate-event)
  • in terminal, it sends the standard event (e.g. mouse-wheel-down-event)

As a consequence, in GUI, centered-cursor-mode is broken.

I have found a patch in the code that seems to work for me, I will open a PR.

Selecting text with mouse is inaccurate

I'm using OSX with https://emacsformacosx.com and Fefora28 with xemacs with the centered-cursor-mode enabled and trying to select some text I noticed that the selection does not line up with my current cursor location and it also seems to jump/up down the buffer.

Is this a known side effect, or do I need to tweak anything further?

Option to disable centering at beginning of file

There's already an option to disable recentering at EOF, it would make a lot of sense if there were an equivalent option for centering at BOF as well. Presently, when centered-cursor-mode is enabled, it is not possible to get to the beginning of the file with PgUp.

Centered Cursor Mode is disabled during search+replace

I observed the following behavior on spacemacs in evil mode:

When search+replacing with ":%s\test\bla\gc" the cursor moves to the bottom of the screen when moving through the search results.

Desired behavior:

The cursor should remain centered also when moving through search results.

roadmap to a new release?

I lived with CCM's default for ages and always wanted to eventually look into that weird bug where typing at the end of the document would put the cursor at the bottom of the screen, and when I move up 1 line to edit a typo it'd recenter again, and all this back and forth was rather annoying while actually writing a text where point is naturally at EOF.

Today I find out this can be disabled with a variable. And the new, faster dev branch doesn't even ship with that feautre.

To me, and I may be super biased because I suffered from the annoying ups and down for so long :), not having this functionality at all sounds like a really good idea. I wouldn't know why anyone wants centered cursor at all but not at the EOF.

So I'd like to suggest to whip up a version 2 release for the public. If you need any help @andre-r, what would you like to finish before merging dev into master?

Scrolls buffer at lines 22-23 then scrolls point

If I start at the top of a buffer (one frame, one window open) and C-n down, the point moves down until line 22. Then it scrolls the buffer up, and again, on line 23, it scrolls the buffer up, and then the next C-n begins moving the point down the screen again like normal.

In Messages I have this line: "ccm-map" doesn't start with package's prefix "centered-cursor".

It works in an html files, but not an org file, so I tried adding
(add-hook 'org-mode-hook 'centered-cursor-mode)
and then M-x eval-buffer and still fails in org files.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.