@@ -538,7 +538,7 @@ static int h_read_settings(struct scene_obj *obj, void *vpriv)
tline = (struct scene_obj_textline *)obj;
val = ofnode_read_prop(node, obj->name, &len);
- if (len >= tline->max_chars)
+ if (len >= tline->line_chars)
return log_msg_ret("str", -ENOSPC);
strcpy(abuf_data(&tline->buf), val);
break;
@@ -708,7 +708,7 @@ static int h_read_settings_env(struct scene_obj *obj, void *vpriv)
tline = (struct scene_obj_textline *)obj;
value = env_get(var);
- if (value && strlen(value) >= tline->max_chars)
+ if (value && strlen(value) >= tline->line_chars)
return log_msg_ret("str", -ENOSPC);
if (!value)
value = "";
@@ -328,17 +328,17 @@ static int textline_build(struct build_info *info, ofnode node,
uint edit_id;
const char *name;
char buf[80];
- u32 max_chars;
+ u32 line_chars;
int ret;
name = ofnode_get_name(node);
info->err_prop = "max-chars";
- ret = ofnode_read_u32(node, "max-chars", &max_chars);
+ ret = ofnode_read_u32(node, "max-chars", &line_chars);
if (ret)
return log_msg_ret("max", -ENOENT);
- ret = scene_textline(scn, name, id, max_chars, &ted);
+ ret = scene_textline(scn, name, id, line_chars, &ted);
if (ret < 0)
return log_msg_ret("ted", ret);
@@ -109,7 +109,7 @@ static void dump_textline(struct dump_ctx *ctx,
outf(ctx, "Textline: label_id %x edit_id %x\n",
tline->label_id, tline->edit_id);
ctx->indent += 2;
- outf(ctx, "max_chars %x pos %x\n", tline->max_chars, tline->pos);
+ outf(ctx, "line_chars %x pos %x\n", tline->line_chars, tline->pos);
ctx->indent -= 2;
}
@@ -16,14 +16,14 @@
#include <linux/string.h>
#include "scene_internal.h"
-int scene_textline(struct scene *scn, const char *name, uint id, uint max_chars,
- struct scene_obj_textline **tlinep)
+int scene_textline(struct scene *scn, const char *name, uint id,
+ uint line_chars, struct scene_obj_textline **tlinep)
{
struct scene_obj_textline *tline;
char *buf;
int ret;
- if (max_chars >= EXPO_MAX_CHARS)
+ if (line_chars >= EXPO_MAX_CHARS)
return log_msg_ret("chr", -E2BIG);
ret = scene_obj_add(scn, name, id, SCENEOBJT_TEXTLINE,
@@ -31,12 +31,12 @@ int scene_textline(struct scene *scn, const char *name, uint id, uint max_chars,
(struct scene_obj **)&tline);
if (ret < 0)
return log_msg_ret("obj", -ENOMEM);
- if (!abuf_init_size(&tline->buf, max_chars + 1))
+ if (!abuf_init_size(&tline->buf, line_chars + 1))
return log_msg_ret("buf", -ENOMEM);
buf = abuf_data(&tline->buf);
*buf = '\0';
- tline->pos = max_chars;
- tline->max_chars = max_chars;
+ tline->pos = line_chars;
+ tline->line_chars = line_chars;
if (tlinep)
*tlinep = tline;
@@ -73,7 +73,7 @@ int scene_textline_calc_dims(struct scene_obj_textline *tline,
return log_msg_ret("dim", -ENOENT);
ret = vidconsole_nominal(cons, txt->gen.font_name, txt->gen.font_size,
- tline->max_chars, &bbox);
+ tline->line_chars, &bbox);
if (ret)
return log_msg_ret("nom", ret);
@@ -246,7 +246,7 @@ int scene_textline_open(struct scene *scn, struct scene_obj_textline *tline)
vidconsole_set_cursor_pos(cons, txt->obj.bbox.x0, txt->obj.bbox.y0);
vidconsole_entry_start(cons);
- cli_cread_init(&scn->cls, abuf_data(&tline->buf), tline->max_chars);
+ cli_cread_init(&scn->cls, abuf_data(&tline->buf), tline->line_chars);
scn->cls.insert = true;
scn->cls.putch = scene_textline_putch;
ret = vidconsole_entry_save(cons, &scn->entry_save);
@@ -362,7 +362,7 @@ This shows dumping the cedit::
bbox: (0,0)-(0,0)
dims: 0x0
Textline: label_id 39 edit_id 18
- max_chars 20 pos 20
+ line_chars 14 pos 14
Object 39 (title): type text
flags
bbox: (0,0)-(0,0)
@@ -510,7 +510,7 @@ struct scene_menitem {
* @obj: Basic object information
* @label_id: ID of the label text object (not string ID), or 0 if none
* @edit_id: ID of the editable text object (not string ID)
- * @max_chars: Maximum number of characters allowed
+ * @line_chars: Nominal number of characters in a line (also a hard limit)
* @buf: Text buffer containing current text
* @pos: Cursor position
*/
@@ -518,7 +518,7 @@ struct scene_obj_textline {
struct scene_obj obj;
uint label_id;
uint edit_id;
- uint max_chars;
+ uint line_chars;
struct abuf buf;
uint pos;
};
@@ -855,12 +855,12 @@ int scene_menu(struct scene *scn, const char *name, uint id,
* @scn: Scene to update
* @name: Name to use (this is allocated by this call)
* @id: ID to use for the new object (0 to allocate one)
- * @max_chars: Maximum length of the textline in characters
+ * @line_chars: Number of characters in a line (also a hard limit)
* @tlinep: If non-NULL, returns the new object
* Returns: ID number for the object (typically @id), or -ve on error
*/
-int scene_textline(struct scene *scn, const char *name, uint id, uint max_chars,
- struct scene_obj_textline **tlinep);
+int scene_textline(struct scene *scn, const char *name, uint id,
+ uint line_chars, struct scene_obj_textline **tlinep);
/**
* scene_box() - create a box