viisual / ASCII-Decorator

Convert selected text into banners made up of ASCII art.
354 stars 40 forks source link

Automatically select word under cursor if selection is empty. #24

Closed ccll closed 8 years ago

ccll commented 10 years ago

Most of the time I'm just converting a single word to ASCII, but I must select the word first in order to run the convert command, which is a little annoying, so I made a little tweak:

As long as this doesn't break any current behavior, just added a new 'convenient' one, so I think it can be merged safely without confusing users. Let me know if there is something I'm missing.

j6k4m8 commented 10 years ago

+1. I'd really love to see this functionality!

viisual commented 8 years ago

Nice idea @ccll, pulling to test it out!

viisual commented 8 years ago

Works well, just going to look at the code and see if I can pull up the Font Preview as well if the word isn't selected as in the new case.

viisual commented 8 years ago

Looking at the code changes, not sure how it isn't displaying for the second case, must be a logic bug pre-existing.

Enteleform commented 8 years ago

I disagree with this implementation.

@ccll :

  • If something is selected -> convert the selection (the current behavior)
  • if nothing is selected...
    • if the cursor is on nothing -> do nothing (the current behavior)
    • if the cursor is on a word -> select the word and convert it (added behavior)

  In what case would converting a partial line be useful?

This is what happens when you attempt to do so:

demo  


  I have suggested an alternative implementation here:

Pull Request #28

viisual commented 8 years ago

@ccll @Enteleform I went ahead and pulled #28 as well.

This may conflict directly with how you'd like the plugin to work @ccll. If this is the case we should examine adding a flag preference to determine full line or single word.

Enteleform commented 8 years ago

@ccll

In addition to PR #28, I added some code that will use selection text if it exists or line text otherwise @ PR #30.