micro/internal
Dmytro Maluka 7fe98ccfee calcHash: Remove checking file size
Let calcHash() unconditionally hash whatever buffer it is asked to hash,
and let its callers explicitly check if the buffer is too large before
calling calcHash(). This makes things simpler and less error-prone
(no extra source of truth about whether the file is too large, we don't
need to remember to check if calcHash() fails, we can be sure calcHash()
will actually update the provided hash), and actually faster (since just
calculating the buffer size, i.e. adding line lengths, is faster than
md5 calculation).

In particular, this fixes the following bugs:

1. Since ReOpen() doesn't check calcHash() return value, if the reloaded
   file is too large while the old version of the file is not,
   calcHash() returns ErrFileTooLarge and doesn't update origHash, so
   so Modified() returns true since the reloaded file's md5 sum doesn't
   match the old origHash, so micro wrongly reports the newly reloaded
   file as modified.

2. Since Modified() doesn't check calcHash() return value, Modified()
   may return false positives or false negatives if the buffer has
   *just* become too large so calcHash() returns ErrFileTooLarge and
   doesn't update `buff`.
2024-08-18 15:42:18 +02:00
..
action Adding missing deselect when calling RemoveAllMultiCursors (#3428) 2024-08-15 16:06:32 +02:00
buffer calcHash: Remove checking file size 2024-08-18 15:42:18 +02:00
clipboard Use zyedidia/clipper for external clipboard 2022-06-14 08:40:57 -04:00
config Temporarily don't initialize runtime files in buffer test 2024-04-03 04:37:44 +02:00
display Rework FindMatchingBrace() interface and implementation (#3319) 2024-06-05 00:56:19 +02:00
info Reordered prompt done callback to avoid accessing out of bound history (#3318) 2024-06-02 20:00:13 +02:00
lua Revert "Don't expose Go timers directly to lua" (#3211) 2024-03-25 17:11:12 +01:00
screen Reset mouse release state after restarting the screen 2023-01-29 18:26:55 +01:00
shell Return error with start in RunInteractiveShell 2024-06-22 21:21:13 +08:00
util Move sigterm channel to internal/util 2024-06-17 18:08:18 +08:00
views chore: fix some typos (#3239) 2024-04-08 12:04:38 +02:00