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

Enclose text into quotes,parens,etc. #229

Merged
merged 6 commits into from
Apr 19, 2018

Conversation

BazookaMusic
Copy link
Contributor

@BazookaMusic BazookaMusic commented Apr 11, 2018

This is an experimental feature which is missing in castor but it needs testing because I have used the clipboard to make it. It works by copying the selected text into the clipboard (doesn't affect previous contents), appending the required openers and closers and pasting the new text back.
I mostly want this to be tested by other system because it could be unstable if the text is not copied or pasted on time. Also, I would like some suggestions on the command's spec because the current form is kind of hard to utter.

To do:

  1. Add the ability to enclose with multiple characters
  2. Add stricter checks to avoid losing previous clipboard content.

Versatilus and others added 5 commits March 29, 2018 15:49
The next release is likely to be 0.6.0.
Added Prolog and VHDL CCR grammars.
JavaScript CCR updates.
VS Code support.
Mostly internal overhaul of Atom support.
Improved Unicode support.
@LexiconCode LexiconCode added WIP An work in progress Enhancement Enhancement of an existing feature labels Apr 11, 2018
@LexiconCode
Copy link
Member

It's a nice enhancement. I'll see if I can give it a test tomorrow!
I'll have to think on command's spec. Right now I can't get the word squiggly for ~ out of my head.

@LexiconCode
Copy link
Member

LexiconCode commented Apr 12, 2018

Okay I'm gonna try to figure out what conditions this was triggered. So far I can't reproduce it.
<type 'exceptions.TypeError'>
Specified clipboard format is not available
<traceback object at 0x15FBAB48>
File "C:\NatLink\NatLink\MacroSystem\caster\lib\context.py", line 109, in read_selected_without_altering_clipboard
prior_content = Clipboard.get_system_text()

File "C:\Python27\lib\site-packages\dragonfly-0.6.6b1-py2.7.egg\dragonfly\windows\clipboard.py", line 53, in get_system_text
content = win32clipboard.GetClipboardData(cls.format_unicode)

@BazookaMusic
Copy link
Contributor Author

BazookaMusic commented Apr 13, 2018

Looking at the code of dragonfly that's in a try except block. I have no Idea how that wasn't caught. Did it crash caster?

@LexiconCode
Copy link
Member

No it did not.

@LexiconCode
Copy link
Member

LexiconCode commented Apr 13, 2018

So I have a proposal. The functionality for formatting is awesome. Simplicity could possibly be improved.
The command prekris yields () the trap prekris bow yields () with an empty clipboard/no text selected/highlighted.

Thoughts about about integrating the functionality of trap prekris bow into the prekris and subsequent commands? Text selected/highlighted the prekris command would enclose the text (sometext). No text selected the default behavior ()

Something to consider is the question of what the default behavior is expected by the average end user and also how we set those expectations.

@BazookaMusic
Copy link
Contributor Author

I thought about it but I'm kind of worried about stability. These functions have time.sleep in their definitions. I'm not sure this works well with ccr, I will test it. Another alternative if it doesn't would be to add a keyword to prekris and similar commands which will trigger this behavior. Something like stoosh and sure stoosh. This would make the behavior more clear to users as well.

@LexiconCode
Copy link
Member

LexiconCode commented Apr 14, 2018

Looking at the source code I see we really need to eliminate the timer to make this reliable. That means not utilizing keyboard shortcuts which doesn't seem feasible.

Looking over dragonfly documentation.
Clipboard toolkit
action_paste
It still uses by default, the paste action is the emulated Key("c-v/20") keystroke with a pause.

@LexiconCode LexiconCode added this to the v6 milestone Apr 16, 2018
@LexiconCode
Copy link
Member

I would love to have it simplified but I think for now the best solution like you said is an optional keyword to trigger formatting.

@BazookaMusic
Copy link
Contributor Author

It's really hard to find time for the next one or two weeks because I have a large assignment to build a Linux driver for school. I will work on it when possible
looking at caster navigation and Spark working with ccr, I think It's possible to Simplify it. I will take a look and see what I can do.

@BazookaMusic
Copy link
Contributor Author

So I found something very annoying which sabotages simplification. In some editors like Visual Studio code, pressing control plus C actually copies the whole line if you haven't selected anything. So if you try this function, instead of adding empty enclosing punctuation, it pastes the whole line and closes it. This is not something which I think can be avoided and even if it can it will be pretty slow without editor integration. I have added a word to trigger this function as you said and in the future it can be revised.

Copy link
Member

@LexiconCode LexiconCode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent

@LexiconCode LexiconCode merged commit f12e440 into dictation-toolbox:develop Apr 19, 2018
@LexiconCode LexiconCode added Documentation Issues related to Documentation Complete Pull request is complete and tested as defined by Contributor and removed WIP An work in progress labels Apr 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Complete Pull request is complete and tested as defined by Contributor Documentation Issues related to Documentation Enhancement Enhancement of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants