📄 tbuffer.h
字号:
//---------------------------------------------------------
/*
File Name: TBuffer.h
Comments: This file contains the definition of the
text_buffer type.
*/
//---------------------------------------------------------
#ifndef TBUFFER_H
#define TBUFFER_H
//---------------------------------------------------------
// Include Files
#include "TString.h"
#include "MiscType.h"
// End Include Files
//---------------------------------------------------------
//---------------------------------------------------------
// Enumerated Types
typedef enum
{
TBE_NO_ERROR = 0,
TBE_OUT_OF_MEMORY,
TBE_CANT_ALLOCATE_BUFFER,
TBE_CANT_OPEN_FILE,
TBE_CANT_WRITE_TO_FILE
} text_buffer_error;
// End Enumerated Types
//---------------------------------------------------------
//---------------------------------------------------------
// Types
typedef struct
{
text_string *allRows;
int totalRows;
int topLine;
boolean isDirty;
text_buffer_error errorStatus;
} text_buffer;
// End Types
//---------------------------------------------------------
//---------------------------------------------------------
// Prototypes.
void TextBufferInitialize(text_buffer *tBuffer);
void TextBufferSetRow(text_buffer *tBuffer,
int rowNumber,
text_string textString);
void TextBufferGetRow(const text_buffer * const tBuffer,
int rowNumber,
text_string *textString);
void TextBufferScrollUp(text_buffer *tBuffer,
int linesToScroll);
void TextBufferScrollDown(text_buffer *tBuffer,
int linesToScroll,
int displayAreaHeight);
void TextBufferScrollToBeginning(text_buffer *textBuffer);
void TextBufferScrollToEnd(text_buffer *textBuffer);
int TextBufferGetTopLine(const text_buffer * const tBuffer);
void TextBufferSaveToFile(text_buffer *textBuffer,
text_string fileName);
void TextBufferLoadFromFile(text_buffer *textBuffer,
text_string fileName);
int TextBufferGetBufferLength(
const text_buffer * const tBuffer);
text_buffer_error TextBufferGetError(text_buffer *tBuffer);
void TextBufferClearError(text_buffer *tBuffer);
void TextBufferFree(text_buffer *tBuffer);
// End Prototypes.
//---------------------------------------------------------
#endif
// End TBuffer.h
//---------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -