micro-editor / micro-editor/micro
Micro crashes when copypasting from a PDF
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 29.6k
- Forks
- 1.4k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 10
Description
- Opened Micro with micro file.c to create a file.
- Inserted the following snippet with Alt+s:
# #include <...>
snippet inc
#include <stdio.h>
int main(void)
{
${0}
return 0;
}
3. Copied the following text from a PDF file with CTRL+C and pasted it into file.c with CTRL+V:
Write a program that reads products’ codes and stores them in an integer array of
50 places. The program should store a code in the array only if it is not already stored. If
the array becomes full or the user enters -1, the program should display the stored codes
and terminate.
- Pressed CTRL+Z to fix the text, which was badly indented.
After that the program crashes with the following message:
Options: [r]ecover, [i]gnore: i
Micro encountered an error: runtime.boundsError runtime error: index out of range [6] with length 6
runtime/panic.go:89 (0x559855ed167f)
github.com/zyedidia/micro/internal/buffer/line_array.go:278 (0x559856323eb8)
github.com/zyedidia/micro/internal/buffer/line_array.go:237 (0x559856323587)
github.com/zyedidia/micro/internal/buffer/buffer.go:141 (0x559856316e3f)
github.com/zyedidia/micro/internal/buffer/eventhandler.go:119 (0x55985632038f)
github.com/zyedidia/micro/internal/buffer/eventhandler.go:51 (0x55985631fc7e)
github.com/zyedidia/micro/internal/buffer/eventhandler.go:137 (0x55985632182c)
github.com/zyedidia/micro/internal/buffer/eventhandler.go:136 (0x559856321817)
github.com/zyedidia/micro/internal/buffer/eventhandler.go:272 (0x5598563216b9)
github.com/zyedidia/micro/internal/action/actions.go:990 (0x55985635358c)
github.com/zyedidia/micro/internal/action/bufpane.go:454 (0x55985635d077)
github.com/zyedidia/micro/internal/action/bufpane.go:142 (0x55985635bc96)
github.com/zyedidia/micro/internal/action/bufpane.go:26 (0x55985635b9f6)
github.com/zyedidia/micro/internal/action/bufpane.go:437 (0x55985635cdf9)
github.com/zyedidia/micro/internal/action/bufpane.go:354 (0x55985635cb1c)
github.com/zyedidia/micro/internal/action/tab.go:254 (0x55985636c54e)
github.com/zyedidia/micro/internal/action/tab.go:136 (0x55985636be96)
github.com/zyedidia/micro/cmd/micro/micro.go:445 (0x559856390ff9)
github.com/zyedidia/micro/cmd/micro/micro.go:382 (0x559856390a54)
runtime/proc.go:250 (0x559855ed6373)
runtime/asm_amd64.s:1571 (0x559855f04121)
I tested with different texts (step 3) following the same procedure and Micro sometimes crashes, and sometimes doesn't.
Specifications
Micro 2.0.9
OS: Windows 10 with WSL (version: 1.2.5.0)
Terminal: Windows Terminal 1.17.11461.0
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the PDF paste, undo sequence in Micro, then inspect internal/buffer/line_array.go and internal/buffer/eventhandler.go at the reported locations. Trace the undo handling reached from internal/action/actions.go and add or update a regression test if the relevant test area is identified. Done means the sequence no longer produces an index-out-of-range panic.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100