atom-minimap / minimap

A preview of the full source code.
https://atom.io/packages/minimap
MIT License
646 stars 129 forks source link

Fit to window height (kate-like behaviour) #505

Open Evpok opened 8 years ago

Evpok commented 8 years ago

Posting this forgotten1 comment as its own feature request.

Please, also consider an option to have a minimap auto-resized vertically, so it would eliminate a need to scroll it. This is how minimap works in Kate editor, and it makes the map a really fast tool for jumping between various places in large source files, despite it being less accurate that way.

To be clear: Kate's minimap is not scrollable. Instead, when the file is longer than the minimap allows, the character height (in minimap) is decreased to make the whole file fit vertically in the minimap. This way, the minimap is less precise but provides a better overview.

Of course it should be behind a setting, if not a module, but I don't know if the latter is possible short of monkey-patching a dynamic character height.


1 And rightfully so, since it was not in the right place.

abe33 commented 8 years ago

Hi @Evpok, sorry for the late reply.

I think this feature was already suggested a while ago, I haven't the issue under the hand though. Having thought a bit about it I identified several major issues with this feature:

That being said, it would be better to have a working proof of concept to gauge the cost and benefits of each strategy. I'll see if I can find some time to try the second approach. But if anyone want to give it a try I'm open to suggestion and of course PRs.

zypA13510 commented 8 years ago

Hi, I was just looking for this settings. It's just a pity it is not implemented yet.

For me, the need of this enhancement comes from a completely different usage, which I believe it's not what minimap was originally planned for. However minimap is still the closest I can get. I don't need a overview of every character. I only want minimap to render base on lines, so that I can easily identify large code blocks, and navigate to the error/diff among them. (There are plugins for minimap which will highlight the entire line, like minimap-linter, or minimap-git-diff)

For now, my solution is, in settings, set

Absolute mode = true;
Adjust minimap only if smaller = true;
Adjust minimap width to soft wrap = false;

and then in the stylesheet, add:

atom-text-editor::shadow, atom-text-editor, html {
  atom-text-editor-minimap {
    &.absolute {
      width: 2%;
    }
  }
}

But due to the nature of fixed line height in minimap, it is not synchronized with the scroll bar. But it's so narrow now, I can hardly click on it to navigate. That's why I'm looking for this.

Evpok commented 8 years ago

Hi, thanks for such a detailed reply! I have to admit I know next to nothing of canvas, but why couldn't we still reuse the unchanged parts by rescaling them?

Also I fiddled with Kate a bit, and instead of applying the changes to them minimap in real time (like you do), it waits until typing stops, would that be sufficient to address the performance concerns? Though that may be too great a deviation from the original behaviour of this package.

abe33 commented 8 years ago

I won't have much time to play around with that feature, but if anyone wants to give it a try and make a prof of concept, I'll be glad to take a look at it.