D17949: ViewPrivate: Make applyWordWrap() more comfortable

Dominik Haumann noreply at phabricator.kde.org
Tue Jan 15 19:58:31 GMT 2019


dhaumann added a comment.


  @loh.tar Slightly related: You may want to also have a look at this: https://phabricator.kde.org/source/ktexteditor/browse/master/src/script/data/commands/utils.js$271
  In short, there is a command line command (F7) called 'rewrap' that rewraps the selection in a "smart" way. My idea when writing this once was:
  
  1. there is a target wrap column, say 80
  2. there is a soft violation wrap column, say 82
  3. there is a minimum wrap column, say 70
  
  Now, lets take the following example:
  
             1         2         3         4         5         6         7         8
    1234567890123456789012345678901234567890123456789012345678901234567890123456789012345
    the quick brown fox jumps of the lazy dog. The bla bla bla bla bla aRatherLongWord
  
  Now, usually, aRatherLongWord would wrap to the next line, since it is longer that column 80. However, it leaves a "big gap" starting at column <70 (cf. 3. soft wrap above) in the end of the line, which is visually not so appealing ;) So in this case, we allow violation of the hard-wrap at 80, and instead allow a violation up to column 82 (cf. 2. above).
  
  With this, you can for instance nicely rewrap a TeX document so that you can nicely read it without too big gaps at the end of a line.
  
  However, to be honest, I don't even know whether I ever finished the implementation, so maybe rewrap even does something different...

REPOSITORY
  R39 KTextEditor

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

To: loh.tar, #ktexteditor, mwolff
Cc: dhaumann, cullmann, mwolff, kwrite-devel, kde-frameworks-devel, #ktexteditor, hase, michaelh, ngraham, bruns, demsking, sars
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kwrite-devel/attachments/20190115/1af5f461/attachment.html>


More information about the KWrite-Devel mailing list