D17693: DocumentPrivate: Treat some chars also as "auto bracket" only when we have a selection

2019-01-24 Thread loh tar
loh.tar added a comment.


  > If you want to get this behavior for Markdown
  
  Even I had mentioned Markdown as example, I would prefer to have this as 
general  behavior. Not only because I don't know anything about that highlight 
stuff and can't implement it this way.
  
  I often write some text in "Normal" mode and may miss then that. I tend to 
add some option for that as @cullmann suggested. BTW  he was not annoyed while 
testing it (well, with an earlier version) So it may less annoying than 
thought. I can remember I was also sometimes annoyed by the normal auto-bracket 
feature, it may only need some familiarization.

REPOSITORY
  R39 KTextEditor

REVISION DETAIL
  https://phabricator.kde.org/D17693

To: loh.tar, #ktexteditor, cullmann, mwolff
Cc: mwolff, cullmann, sars, kwrite-devel, kde-frameworks-devel, #ktexteditor, 
hase, michaelh, ngraham, bruns, demsking, dhaumann


D17693: DocumentPrivate: Treat some chars also as "auto bracket" only when we have a selection

2019-01-24 Thread Milian Wolff
mwolff requested changes to this revision.
mwolff added a comment.
This revision now requires changes to proceed.


  Ok, that behavior you describe is bad. I would get annoyed by that, esp. 
since the list of chars that you use are totally language specific.
  
  If you want to get this behavior for Markdown, then we need to store that 
data in the syntax file and make it accessible at this position. in the 
`` section we already define how single/multiline comments are 
handled. We would need something similar for this feature, e.g. add something 
like the following and make it accessible through the syntax-highlighting API:
  

  































  

  
  Of course the initial, common, brackets should be the implicit default when 
no `` group is specified in a language file. And then we probably 
need more meta data that specified that some of the brackets above only should 
be added when we have a selection. Just add a `requiresSelection` or similar 
attribute?

REPOSITORY
  R39 KTextEditor

REVISION DETAIL
  https://phabricator.kde.org/D17693

To: loh.tar, #ktexteditor, cullmann, mwolff
Cc: mwolff, cullmann, sars, kwrite-devel, kde-frameworks-devel, #ktexteditor, 
hase, michaelh, ngraham, bruns, demsking, dhaumann


D17693: DocumentPrivate: Treat some chars also as "auto bracket" only when we have a selection

2019-01-24 Thread Christoph Cullmann
cullmann added a comment.


  Either one would need to expose more info from the xml highlighting 
definitions or as poor mans fix provide some config entry to allow people 
themself to specify which () ""  pairs the want to have handled globall 
with minimal defaults.

REPOSITORY
  R39 KTextEditor

REVISION DETAIL
  https://phabricator.kde.org/D17693

To: loh.tar, #ktexteditor, cullmann
Cc: mwolff, cullmann, sars, kwrite-devel, kde-frameworks-devel, #ktexteditor, 
hase, michaelh, ngraham, bruns, demsking, dhaumann


D17693: DocumentPrivate: Treat some chars also as "auto bracket" only when we have a selection

2019-01-24 Thread loh tar
loh.tar added a comment.


  There is an `enum KSyntaxHighlighting::Theme::TextStyle::Operator` but I 
can't find a function to test for that. 
  Beside that I guess it would not work anyway. If it's an operator or not need 
a call to some "update highlight" to investigate the context.
  
  Ideas?

REPOSITORY
  R39 KTextEditor

REVISION DETAIL
  https://phabricator.kde.org/D17693

To: loh.tar, #ktexteditor, cullmann
Cc: mwolff, cullmann, sars, kwrite-devel, kde-frameworks-devel, #ktexteditor, 
hase, michaelh, ngraham, bruns, demsking, dhaumann


D17693: DocumentPrivate: Treat some chars also as "auto bracket" only when we have a selection

2019-01-23 Thread loh tar
loh.tar added a comment.


  
  
  > the selection becomes wrapped in two ? - is that right?
  
  Yes
  
  > if we only want this for, say, markdown, then it should be a 
per-highlightfile list of chars that trigger this special behavior
  
  How that?
  
  > if I have foo + bar and I select the + bar part and then start typing - 
asdf, would I now suddenly get foo -+ bar- asdf?!
  
  Just try it. Almost right. Due it's behavior to move the cursor at the start 
of the selection and to keep the selection it becomes `foo - asfd-`
  
  > In C++ e.g. I would hate if I couldn't just select code and replace it by 
an operator anymore,
  
  Hm, I see. IIRC has the highlight stuff functions to ask the type of 
something. So probably there is a `isOperator(QChar c)` function available. 
Will then try that.
  
  If not. Would it be too annoying to type `- SPACE asdf DEL`?

REPOSITORY
  R39 KTextEditor

REVISION DETAIL
  https://phabricator.kde.org/D17693

To: loh.tar, #ktexteditor, cullmann
Cc: mwolff, cullmann, sars, kwrite-devel, kde-frameworks-devel, #ktexteditor, 
hase, michaelh, ngraham, bruns, demsking, dhaumann


D17693: DocumentPrivate: Treat some chars also as "auto bracket" only when we have a selection

2019-01-23 Thread Milian Wolff
mwolff added a comment.


  can you say what this exactly does? from reading the code and the somewhat 
vague commit message, it makes me believe that when I have anything selected 
and then press e.g. `?` the selection becomes wrapped in two `?` - is that 
right? when would we ever want this?
  
  and if we only want this for, say, markdown, then it should be a 
per-highlightfile list of chars that trigger this special behavior. In C++ e.g. 
I would hate if I couldn't just select code and replace it by an operator 
anymore, e.g. if I have `foo + bar` and I select the `+ bar` part and then 
start typing `- asdf`, would I now suddenly get `foo -+ bar- asdf`?!

REPOSITORY
  R39 KTextEditor

REVISION DETAIL
  https://phabricator.kde.org/D17693

To: loh.tar, #ktexteditor, cullmann
Cc: mwolff, cullmann, sars, kwrite-devel, kde-frameworks-devel, #ktexteditor, 
hase, michaelh, ngraham, bruns, demsking, dhaumann


D17693: DocumentPrivate: Treat some chars also as "auto bracket" only when we have a selection

2019-01-22 Thread loh tar
loh.tar updated this revision to Diff 50061.
loh.tar edited the summary of this revision.
loh.tar set the repository for this revision to R39 KTextEditor.
loh.tar added a comment.


  - const QChar as value, not reference
  - Add , ; - + ^ ° § & just for completeness

REPOSITORY
  R39 KTextEditor

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D17693?vs=49452&id=50061

REVISION DETAIL
  https://phabricator.kde.org/D17693

AFFECTED FILES
  src/document/katedocument.cpp

To: loh.tar, #ktexteditor, cullmann
Cc: cullmann, sars, kwrite-devel, kde-frameworks-devel, #ktexteditor, hase, 
michaelh, ngraham, bruns, demsking, dhaumann


D17693: DocumentPrivate: Treat some chars also as "auto bracket" only when we have a selection

2019-01-20 Thread Christoph Cullmann
cullmann requested changes to this revision.
cullmann added a comment.
This revision now requires changes to proceed.


  Played a bit with it, works reasonable.
  Just replace const QChar &c with const QChar and we let this in.

REVISION DETAIL
  https://phabricator.kde.org/D17693

To: loh.tar, #ktexteditor, cullmann
Cc: cullmann, sars, kwrite-devel, kde-frameworks-devel, #ktexteditor, hase, 
michaelh, ngraham, bruns, demsking, dhaumann


D17693: DocumentPrivate: Treat some chars also as "auto bracket" only when we have a selection

2019-01-14 Thread loh tar
loh.tar updated this revision to Diff 49452.
loh.tar retitled this revision from "DocumentPrivate: Treat angle bracket < and 
backtick ` also as "auto bracket" when we have a selection" to 
"DocumentPrivate: Treat some chars also as "auto bracket" only when we have a 
selection".
loh.tar edited the summary of this revision.
loh.tar added a comment.


  - Add chars ´ ` _ . : | # @ ~ * ! ? $ % / \ = to special handling
  - Avoid chars[0]

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D17693?vs=47857&id=49452

REVISION DETAIL
  https://phabricator.kde.org/D17693

AFFECTED FILES
  src/document/katedocument.cpp

To: loh.tar, #ktexteditor
Cc: cullmann, sars, kwrite-devel, kde-frameworks-devel, #ktexteditor, hase, 
michaelh, ngraham, bruns, demsking, dhaumann