文本编辑理论 [英] Text editor theory

查看:149
本文介绍了文本编辑理论的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于我一直对现有编辑不满意,所以我一直想开始的一个项目是我自己的文本编辑器。然而,做文字编辑是一件很严重的事情。



除了分析现有文本编辑器的源代码,有关这个主题的书籍或其他资源(如学术着作)吗?我特别感兴趣的是教会如何处理内存和如何管理文本插入的东西(如果你有一个100 MB的文件,并希望在 x 位置添加一个字符,你不能只是 memmove 巨大的文本块...)。

解决方案

Rob Pike对他的山姆文本编辑器的描述。请务必浏览高级概述和命令语言。他在本文后面介绍了解析,内存管理和数据结构。



另外,看看Russ Cox的简单的正则表达式实现。很容易遵循,可能会在现有的正则表达式库之外打开一些门。


As I'm always dissatisfied with existing editors, a project I always wanted to start is my own text editor. However doing text editing is serious business.

Besides analyzing the source code of existing text editors, is there any book or other resource (like academic work) about this topic? I'm interested especially in something that teaches how to handle memory and how to manage text insertion (if you have a 100 MB file and want to add a char at x position, you can't just memmove the huge text block...).

解决方案

Take a look at Rob Pike's description of his Sam text editor. Be sure to browse past the high-level overview and command language. He describes parsing, memory management, and data structures later in the paper.

In addition, take a look at Russ Cox's simple regular expression implementation. It's easy to follow and may open some doors outside existing regular expression libraries.

这篇关于文本编辑理论的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆