Comments (5)
Thank you for the extremely fast turnaround!
As of 20170530.953, this issue appears to be fixed for me.
And thank you for the in-depth explanation! One day I hope to better be able to contribute to elisp projects so I find this stuff very interesting
from typescript.el.
Thanks for the very detailed bug-report! I can reproduce this one.
From what I can tell indent-according-to-mode
calls back into typescript-indent-line
(which was fixed for another error 26.05.2017) and this seems to introduce the error.
In your example our new "unicode-aware" typescript--current-column
function returns 23
where regular current-column
returns 30
(which is also reported by column-number-mode
) This causes the cursor to be positioned incorrectly. This is obviously wrong.
Looking at it in depth, it seems this was caused by the first char of the line actually being a tab
, which column-wise would represent 8
spaces. (Thus 23-1+8 = 30)
A temporary workaround could be not to use tabs, but prefer spaces, but I can see how that doesn't work out for everyone.
I'm not sure what a good solution for everyone would be here, but I'll try to take a deeper look at it.
from typescript.el.
Update: basically it seems like the column
and char
concept in Emacs is not really compatible, and should not ever be mixed when doing accounting:
- a single Chinese/Wide unicode character counts as several "columns", but as 1 character.
- a tab counts as 1 character, but also as several "columns".
As long as typescript-indent-line
mixes these, we will get errors, and I think the best approach is to rewrite it to use columns exclusively.
This means we'll have to replace forward-char
with move-to-column
for repositioning.
from typescript.el.
Added another test-case. With this patch in, indentation works for both tabs and wide chars.
Let me know if it works for you as well.
from typescript.el.
Thanks for reporting back! Glad to hear your issues are solved.
As for detailed explanation... Consider it thinking out loudly. Sometimes I can't figure out how to fix things, but I have made concrete findings. By reporting these it may help other Emacs'ers spot the error instead. ;)
from typescript.el.
Related Issues (20)
- Consider migrating CI to something not Travis HOT 5
- Symbol’s value as variable is void: compilation-error-regexp-alist-alist HOT 4
- Indentation hangs in `typescript--backward-to-parameter-list` when previous function has unbalanced parens
- typescript-mode hangs if I enter a newline after a dot character.
- File mode specification error: (void-function -compose) HOT 3
- typescript new keyword 'override' highlight HOT 2
- M-j in /** foo */ comment blocks is broken. Reasonbly easy to fix HOT 3
- Bump Version Tag HOT 8
- const, let formatting with multiple lines HOT 1
- Missing debugger keyword HOT 1
- Freeze on indenting dot after comma HOT 1
- `typescript-mode` is failing to download HOT 4
- Incorrect highlighting of keywords on latest commit HOT 5
- Adding mechanisms in place not to collide with in-tree typescript-mode HOT 7
- typescript 4.9 - satisfies operator HOT 1
- No option to achieve desired formatting HOT 1
- typescript--backward-to-parameter-list can cause multi-second delays in large files HOT 4
- Diagnostics don't show until file is changed HOT 1
- Thanks HOT 1
- matching closing tags in jsx in typescript-ts-mode HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typescript.el.