#51 Fix `set_parse_state`'s inefficiency

已关闭
nuclearkev1 年之前创建 · 2 条评论

This function is used primarily to see if you're in a multi-line comment or string and keeps the syntax highlighting decent. The issue, however, is that it's starts at point 0 and works up to the curbp->b_point which means on massive files it is extremely slow.

My initial idea is that it only starts at some percentage of the file and not the beginning but that isn't the best idea. Another idea could be that upon insert_file I run through the file and mark ranges of comments. If I do that it would require me to update those ranges when a new multi-line comment/string is added. Neither seem like a great idea - I'll keep brainstorming.

This function is used primarily to see if you're in a multi-line comment or string and keeps the syntax highlighting decent. The issue, however, is that it's starts at point 0 and works up to the `curbp->b_point` which means on massive files it is extremely slow. My initial idea is that it only starts at some percentage of the file and not the beginning but that isn't the best idea. Another idea could be that upon `insert_file` I run through the file and mark ranges of comments. If I do that it would require me to update those ranges when a new multi-line comment/string is added. Neither seem like a great idea - I'll keep brainstorming.

This function seems to cause more issues on slower terminal emulators such as Terminal.app on MacOS. You'll see a lot of jumping cursors as you scroll around when this happens. You also will see this more often when using a terminal multiplexer such as tmux(1). I'm not sure why.

To be honest, I find this unacceptable and I really ought to find a solution to this.

This function seems to cause more issues on slower terminal emulators such as Terminal.app on MacOS. You'll see a lot of jumping cursors as you scroll around when this happens. You also will see this more often when using a terminal multiplexer such as tmux(1). I'm not sure why. To be honest, I find this unacceptable and I really ought to find a solution to this.

Due to the difficulty with figuring out if the page is within a mutli-line string, I decided to just make rendering a little more efficient.

Since there is no difference between the start and end of a string ', ", or ` we can't use any pattern matching for it from the point backwards.

Due to the difficulty with figuring out if the page is within a mutli-line string, I decided to just make rendering a little more efficient. Since there is no difference between the start and end of a string ', ", or ` we can't use any pattern matching for it from the point backwards.
登录 并参与到对话中。
正在加载...
取消
保存
这个人很懒,什么都没留下。