Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tag placement and visibility improvements #323

Open
stephanoparaskeva opened this issue Apr 13, 2020 · 6 comments
Open

Tag placement and visibility improvements #323

stephanoparaskeva opened this issue Apr 13, 2020 · 6 comments

Comments

@stephanoparaskeva
Copy link

stephanoparaskeva commented Apr 13, 2020

Is your feature request related to a problem? Please describe.
Frustrating when the jump hints are translucent as it makes hint very hard to see. Also I dont find the green hints very useful, I use vimium in the browser and find that it's best to be minimal. Usually I'm not intending to be super precise and just want to jump to an area and then adjust with h+j+k+l

Describe the solution you'd like
There should be an option to make all hints have full opacity. Id even argue that there should be an option to turn off the green hints as well, so you can have: only full opacity yellow hints

These would be optional and therefore not affect the core functionality.

Additional context
Here is a picture of what I mean, as you can see hints like JJ and R are clear but those of GG and FF are harder to see (when you view the editor at fullscreen and not zoomed in like it is here) and IMO the green hints just get in the way and don't provide any benefits (its useful to know what you've typed but id argue the cons are at least equal to or greater):

Screenshot 2020-04-13 at 15 51 01

@stephanoparaskeva stephanoparaskeva changed the title Option to make hints easier to see Option to make hints easier to see and Turn Off green hints Apr 13, 2020
@breandan
Copy link
Collaborator

Related to #228, #227. We should probably avoid painting adjacent characters. Agree that it would be nice to make the opacity/placement customizable. Text highlight color is already customizable, but the opacity rules for proceeding tags are not clear. By default, we try to always place tags to the left of the match, except if it is the first character of the line or would overlap with another tag location.

@breandan
Copy link
Collaborator

One solution is to always paint tags to the left of the match location at full opacity and enforce a minimum tag separation. The only issue is, I'm not sure how to paint tags to the left of the first character on a line in the editor window. If anyone wants to try solving this, here is the current implementation:

val isFirstCharacterOfLine = editor.isFirstCharacterOfLine(index)
val canAlignLeft = !isFirstCharacterOfLine && canvas.isFree(left)

@stephanoparaskeva
Copy link
Author

stephanoparaskeva commented Apr 20, 2020

Do you mean left or right? I ask because the tags with <1 opacity are all on the right of the location.
Is it also possible to turn off green tags?

I could jump in, but I've no experience with Kotlin dev and so wouldn't likely produce good results in a short timeframe, if anyone can give it a shot that'd be great, if not i'll try in free time when able, is this the best place to start?

@breandan
Copy link
Collaborator

breandan commented Apr 21, 2020

AceJump always paints tags to left, except (1) when it is the first character of a line or (2) overlaps with an existing tag. In these cases, it paints tags to the right of the match with transparency so that users can to see the text if they want to continue typing. Tag locations are tracked by Canvas:

fun registerTag(p: Point, tag: String) =
(-1..tag.length).forEach { occupied.add(Point(p.x + it * fontWidth, p.y)) }
fun isFree(point: Point) = point !in occupied

The green boxes are not tags, but RangeHighlighters, which are rendered beneath the editor text:

override fun paint(editor: Editor, highlighter: RangeHighlighter, g: Graphics) =

Essentially, this is the same mechanism the Find dialog (Ctrl/Cmd+F) uses to highlight text. Tags are rendered using a different mechanism, which paints above the editor text:

private fun Graphics2D.drawTagForeground(tagPosition: Point?) {

It is already possible to customize the highlight color via Settings > AceJump > "Text highlight color". If you don't want to see any highlights, you could set it to match the editor background color.

Is this the best place to start?

Yes, more than happy to accept PRs. The simplest solution is probably to always paint tags to the left at full opacity and skip matches which are directly adjacent. Feel free to open a PR and tag this issue. Don't hesitate to ask if you have any questions!

@breandan breandan changed the title Option to make hints easier to see and Turn Off green hints Tag placement and visibility improvements Apr 21, 2020
@Ciel-MC
Copy link

Ciel-MC commented Dec 3, 2022

image

Why does it only put my tag on the same line, while in the screenshot, it will place the tag above if the line is empty?

@breandan
Copy link
Collaborator

breandan commented Jan 6, 2023

@Ciel-MC Thanks for pointing this out. The tag placement rules were most likely lost during one of the multiple rewrites over the years, however we should restore the original behavior to not occlude adjacent text. I would like to reimplement this but do not have the bandwidth at present. PRs are highly welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants