[PR #301] [MERGED] Implements a buffer limit for the Text widget. #317

Closed
opened 2026-03-03 16:23:51 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mum4k/termdash/pull/301
Author: @mum4k
Created: 4/3/2021
Status: Merged
Merged: 4/3/2021
Merged by: @mum4k

Base: develHead: bufferlimit


📝 Commits (10+)

  • 7225045 Implements a buffer limit for the Text widget (#294)
  • ae4be21 Merge branch 'devel' into bufferlimit
  • 3faca08 Renaming the option to MaxTextCells.
  • 3a86253 Noting MaxTextCells in the CHANGELOG.
  • e1c872d Refactor text truncation.
  • 0f1a339 Correctly handle wide runes.
  • 18e27ec Correctly handle newline characters.
  • 6a2d2bb Correctly account for pre-existing full-width runes in the content.
  • 4ef1db1 Runewidth allows overrides.
  • 750270f Remove custom runewidth and stringwidth helpers.

📊 Changes

6 files changed (+396 additions, -7 deletions)

View changed files

📝 CHANGELOG.md (+5 -0)
📝 private/runewidth/runewidth.go (+47 -3)
📝 private/runewidth/runewidth_test.go (+22 -3)
📝 widgets/text/options.go (+25 -0)
📝 widgets/text/text.go (+48 -1)
📝 widgets/text/text_test.go (+249 -0)

📄 Description

See issue #293 where memory and performance can degrade with a high number of lines written to the Text widget.

This is a very simplistic implementation to limit the possible length the text buffer can grow to with the maxContent option.

Default value of -1 means there's no limit and therefore behaviour should remain standard.

It has been working in our test app and allows the use of the Text widget to monitor logs (ie tail) and therefore doesn't bloat over time, but happy to adjust as required.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/mum4k/termdash/pull/301 **Author:** [@mum4k](https://github.com/mum4k) **Created:** 4/3/2021 **Status:** ✅ Merged **Merged:** 4/3/2021 **Merged by:** [@mum4k](https://github.com/mum4k) **Base:** `devel` ← **Head:** `bufferlimit` --- ### 📝 Commits (10+) - [`7225045`](https://github.com/mum4k/termdash/commit/7225045bb294266e922b31c77b9084edafeefcbc) Implements a buffer limit for the Text widget (#294) - [`ae4be21`](https://github.com/mum4k/termdash/commit/ae4be2143e95e78df72b90d7309e3842753862f3) Merge branch 'devel' into bufferlimit - [`3faca08`](https://github.com/mum4k/termdash/commit/3faca085c4016385e2aef858d143745d85d7eaad) Renaming the option to MaxTextCells. - [`3a86253`](https://github.com/mum4k/termdash/commit/3a86253373059944a12dc82d458a6561c4f6e6e6) Noting MaxTextCells in the CHANGELOG. - [`e1c872d`](https://github.com/mum4k/termdash/commit/e1c872d0c118c74ee96d6c25dd33fa5afeec2265) Refactor text truncation. - [`0f1a339`](https://github.com/mum4k/termdash/commit/0f1a339459858cf338d567d697d71567ff32f01b) Correctly handle wide runes. - [`18e27ec`](https://github.com/mum4k/termdash/commit/18e27ecc152569cbfc35e964b2e196b683d93af0) Correctly handle newline characters. - [`6a2d2bb`](https://github.com/mum4k/termdash/commit/6a2d2bb515e3550efc80710468e32406ca55c67d) Correctly account for pre-existing full-width runes in the content. - [`4ef1db1`](https://github.com/mum4k/termdash/commit/4ef1db1f9945534e5fc4692f30b66268168dbbb5) Runewidth allows overrides. - [`750270f`](https://github.com/mum4k/termdash/commit/750270fa89e7580898e4c0a1bde652fd73e245b7) Remove custom runewidth and stringwidth helpers. ### 📊 Changes **6 files changed** (+396 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+5 -0) 📝 `private/runewidth/runewidth.go` (+47 -3) 📝 `private/runewidth/runewidth_test.go` (+22 -3) 📝 `widgets/text/options.go` (+25 -0) 📝 `widgets/text/text.go` (+48 -1) 📝 `widgets/text/text_test.go` (+249 -0) </details> ### 📄 Description See issue #293 where memory and performance can degrade with a high number of lines written to the Text widget. This is a very simplistic implementation to limit the possible length the text buffer can grow to with the `maxContent` option. Default value of -1 means there's no limit and therefore behaviour should remain standard. It has been working in our test app and allows the use of the Text widget to monitor logs (ie tail) and therefore doesn't bloat over time, but happy to adjust as required. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-03 16:23:51 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/termdash#317
No description provided.