bigfive / atom-sublime-select

Enable 'sublime style' multiline selection boxes to Atom editor http://atom.io
MIT License
233 stars 49 forks source link

About bytes of Chinese character #146

Open gmx321 opened 7 years ago

gmx321 commented 7 years ago

In package 1.7.4, the bytes of Chinese character is 1, could you set it as 2 ? Thanks.

Example for test:

exm1模3多开柱:=BARSLAST(模3多头起点); exm22模3多平柱:=BARSLAST(模3多头终点); exm333模3空开柱:=BARSLAST(模3空头起点); exm4444模3空平柱:=BARSLAST(模3空头终点);

bigfive commented 5 years ago

Oof, thats tricky. I currently use the editor.getDefaultCharWidth() and use it to figure out how long the selection should be in order to support selecting beyond the current line length.

Heres my function https://github.com/bigfive/atom-sublime-select/blob/master/lib/editor-handler.coffee#L87-L98

Heres atoms function that takes differing char widths into account (but doesn't allow selecting beyond the current line length) https://github.com/atom/atom/blob/d2c38ac36a46c067b7f1fe1edc41bcf7b4b13e73/src/text-editor-component.js#L2379-L2456

Maybe I could call the atom version per line or something. If anyone wants to try tackling that I'd love it.