orgmode icon indicating copy to clipboard operation
orgmode copied to clipboard

orgmode hangs up when working with multiple lines of brackets

Open odysseyalive opened this issue 1 year ago • 3 comments

Describe the bug

I use orgmode to handle all of my notes. I've noticed that anytime multiple brackets are displayed on the screen, orgmode locks up. This includes expanding the current time tracking for specific tasks, too.

Steps to reproduce

Open up an org file. Create a topic. Enter the topic and paste the following:

[BLACK_R:19] [BLACK_G:10] [BLACK_B:7] [BLUE_R:34] [BLUE_G:74] [BLUE_B:104] [GREEN_R:119] [GREEN_G:117] [GREEN_B:24] [CYAN_R:101] [CYAN_G:111] [CYAN_B:47] [RED_R:142] [RED_G:20] [RED_B:6] [MAGENTA_R:161] [MAGENTA_G:58] [MAGENTA_B:87] [BROWN_R:130] [BROWN_G:85] [BROWN_B:43] [LGRAY_R:99] [LGRAY_G:86] [LGRAY_B:71] [DGRAY_R:104] [DGRAY_G:38] [DGRAY_B:8] [LBLUE_R:56] [LBLUE_G:146] [LBLUE_B:178] [LGREEN_R:195] [LGREEN_G:193] [LGREEN_B:61] [LCYAN_R:102] [LCYAN_G:175] [LCYAN_B:96] [LRED_R:213] [LRED_G:72] [LRED_B:21] [LMAGENTA_R:213] [LMAGENTA_G:21] [LMAGENTA_B:143] [YELLOW_R:214] [YELLOW_G:156] [YELLOW_B:56] [WHITE_R:208] [WHITE_G:205] [WHITE_B:169]

This can also be reproduced by simply expanding the logbooks for frequently used tasks: :LOGBOOK: CLOCK: [2023-05-29 Mon 16:21]--[2023-05-29 Mon 20:32] => 4:11 CLOCK: [2023-05-28 Sun 16:04]--[2023-05-28 Sun 16:11] => 0:07 CLOCK: [2023-05-27 Sat 17:24]--[2023-05-27 Sat 20:34] => 3:10 CLOCK: [2023-05-25 Thu 15:55]--[2023-05-25 Thu 18:12] => 2:17 CLOCK: [2023-05-25 Thu 15:43]--[2023-05-25 Thu 15:45] => 0:02 CLOCK: [2023-05-24 Wed 12:26]--[2023-05-24 Wed 14:09] => 1:43 CLOCK: [2023-05-24 Wed 12:01]--[2023-05-24 Wed 12:05] => 0:04 CLOCK: [2023-05-23 Tue 15:13]--[2023-05-23 Tue 18:10] => 2:57 CLOCK: [2023-05-22 Mon 20:43]--[2023-05-22 Mon 23:37] => 2:54 CLOCK: [2023-05-22 Mon 14:37]--[2023-05-22 Mon 19:32] => 4:55 CLOCK: [2023-05-22 Mon 12:38]--[2023-05-22 Mon 14:00] => 1:22 CLOCK: [2023-05-22 Mon 10:33]--[2023-05-22 Mon 11:14] => 0:41 CLOCK: [2023-05-19 Fri 13:23]--[2023-05-19 Fri 15:31] => 2:08 CLOCK: [2023-05-18 Thu 19:16]--[2023-05-18 Thu 19:35] => 0:19 CLOCK: [2023-05-18 Thu 18:53]--[2023-05-18 Thu 19:06] => 0:13 CLOCK: [2023-05-18 Thu 17:49]--[2023-05-18 Thu 18:10] => 0:21 CLOCK: [2023-05-18 Thu 14:47]--[2023-05-18 Thu 17:10] => 2:23 CLOCK: [2023-05-18 Thu 12:36]--[2023-05-18 Thu 14:25] => 1:49 CLOCK: [2023-05-18 Thu 10:38]--[2023-05-18 Thu 11:55] => 1:17 CLOCK: [2023-05-17 Wed 10:30]--[2023-05-17 Wed 12:03] => 1:33 CLOCK: [2023-05-11 Thu 15:39]--[2023-05-11 Thu 16:08] => 0:29 CLOCK: [2023-05-09 Tue 10:39]--[2023-05-09 Tue 10:49] => 0:10 CLOCK: [2023-05-09 Tue 16:09]--[2023-05-09 Wed 16:29] => 0:20 CLOCK: [2023-05-09 Tue 13:06]--[2023-05-09 Tue 14:06] => 1:00 :END:

Expected behavior

Nvim should operate smoothly when displaying multiple lines of bracketed text.

Emacs functionality

Using the minimal init lua, copy the logbook above into a task, expand it, and just try to move the cursor around inside it.

Minimal init.lua

vim.cmd([[set runtimepath=$VIMRUNTIME]]) vim.cmd([[set packpath=/tmp/nvim/site]])

local package_root = '/tmp/nvim/site/pack' local install_path = package_root .. '/packer/start/packer.nvim'

local function load_plugins() require('packer').startup({ { 'wbthomason/packer.nvim', { 'nvim-treesitter/nvim-treesitter' }, { 'kristijanhusak/orgmode.nvim', branch = 'master' }, }, config = { package_root = package_root, compile_path = install_path .. '/plugin/packer_compiled.lua', }, }) end

_G.load_config = function() require('orgmode').setup_ts_grammar() require('nvim-treesitter.configs').setup({ highlight = { enable = true, additional_vim_regex_highlighting = { 'org' }, }, })

vim.cmd([[packadd nvim-treesitter]]) vim.cmd([[runtime plugin/nvim-treesitter.lua]]) vim.cmd([[TSUpdateSync org]])

-- Close packer after install if vim.bo.filetype == 'packer' then vim.api.nvim_win_close(0, true) end

require('orgmode').setup()

-- Reload current file if it's org file to reload tree-sitter if vim.bo.filetype == 'org' then vim.cmd([[edit!]]) end end

if vim.fn.isdirectory(install_path) == 0 then vim.fn.system({ 'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path }) load_plugins() require('packer').sync() vim.cmd([[autocmd User PackerCompileDone ++once lua load_config()]]) else load_plugins() load_config() end

Screenshots and recordings

No response

OS / Distro

Ubuntu 22.04

Neovim version/commit

v0.9.0

Additional context

No response

odysseyalive avatar Jun 03 '23 15:06 odysseyalive

This looks a lot like #550.

jgollenz avatar Jun 04 '23 11:06 jgollenz

@bridgesense can you pull latest master and give it another test? Performance should be slightly better now. Slowness is still there while editing, but scrolling and going through the document should be slightly better.

kristijanhusak avatar Jun 05 '23 16:06 kristijanhusak

That is so much better. I couldn't even expand some of my clocks. Thank you!

odysseyalive avatar Jun 05 '23 16:06 odysseyalive