~darkmuggle-deactivatedaccount/ubuntu/quantal/grub2/fix-872244

« back to all changes in this revision

Viewing changes to grub-core/normal/menu_entry.c

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2011-05-17 23:59:10 UTC
  • mto: (17.3.55 sid)
  • mto: This revision was merged to the branch mainline in revision 122.
  • Revision ID: james.westby@ubuntu.com-20110517235910-ma8u889vyjdfro27
Tags: upstream-1.99
ImportĀ upstreamĀ versionĀ 1.99

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
  int x;
53
53
  /* The Y coordinate.  */
54
54
  int y;
 
55
  /* Number of entries.  */
 
56
  int num_entries;
55
57
};
56
58
 
57
59
struct screen
87
89
{
88
90
  linep->len = 0;
89
91
  linep->max_len = 80; /* XXX */
90
 
  linep->buf = grub_malloc (linep->max_len);
 
92
  linep->buf = grub_malloc (linep->max_len + 1);
91
93
  if (! linep->buf)
92
94
    return 0;
93
95
 
188
190
  grub_term_gotoxy (term_screen->term, GRUB_TERM_LEFT_BORDER_X
189
191
                    + grub_term_border_width (term_screen->term),
190
192
                    GRUB_TERM_TOP_BORDER_Y 
191
 
                    + grub_term_num_entries (term_screen->term));
 
193
                    + term_screen->num_entries);
192
194
 
193
195
  if (flag)
194
196
    grub_putcode (GRUB_UNICODE_DOWNARROW, term_screen->term);
209
211
  struct line *linep;
210
212
 
211
213
  /* Check if scrolling is necessary.  */
212
 
  if (term_screen->y < 0 || term_screen->y
213
 
      >= grub_term_num_entries (term_screen->term))
 
214
  if (term_screen->y < 0 || term_screen->y >= term_screen->num_entries)
214
215
    {
215
216
      if (term_screen->y < 0)
216
217
        term_screen->y = 0;
217
218
      else
218
 
        term_screen->y = grub_term_num_entries (term_screen->term) - 1;
 
219
        term_screen->y = term_screen->num_entries - 1;
219
220
 
220
221
      region_start = 0;
221
222
      region_column = 0;
251
252
 
252
253
          for (column = 0;
253
254
               column <= linep->len
254
 
                 && y < grub_term_num_entries (term_screen->term);
 
255
                 && y < term_screen->num_entries;
255
256
               column += grub_term_entry_width (term_screen->term), y++)
256
257
            {
257
258
              if (y < 0)
272
273
                print_line (linep, column, 0, y, term_screen);
273
274
            }
274
275
 
275
 
          if (y == grub_term_num_entries (term_screen->term))
 
276
          if (y == term_screen->num_entries)
276
277
            {
277
278
              if (column <= linep->len || i + 1 < screen->num_lines)
278
279
                down_flag = 1;
282
283
          i++;
283
284
 
284
285
          if (mode == ALL_LINES && i == screen->num_lines)
285
 
            for (; y < grub_term_num_entries (term_screen->term); y++)
 
286
            for (; y < term_screen->num_entries; y++)
286
287
              print_empty_line (y, term_screen);
287
288
 
288
289
        }
289
 
      while (y < grub_term_num_entries (term_screen->term));
 
290
      while (y < term_screen->num_entries);
290
291
 
291
292
      /* Draw up and down arrows.  */
292
293
      if (up)
1165
1166
{
1166
1167
  char *script;
1167
1168
  int errs_before;
1168
 
  grub_menu_t menu;
 
1169
  grub_menu_t menu = NULL;
1169
1170
  char *dummy[1] = { NULL };
1170
1171
 
1171
1172
  auto char * editor_getsource (void);
1185
1186
    size = 0;
1186
1187
    for (i = 0; i < screen->num_lines; i++)
1187
1188
      {
1188
 
        grub_strcpy (source + size, screen->lines[i].buf);
 
1189
        grub_memcpy (source + size, screen->lines[i].buf, screen->lines[i].len);
1189
1190
        size += screen->lines[i].len;
1190
1191
        source[size++] = '\n';
1191
1192
      }
1290
1291
  }
1291
1292
  /* Draw the screen.  */
1292
1293
  for (i = 0; i < screen->nterms; i++)
1293
 
    grub_menu_init_page (0, 1, screen->terms[i].term);
 
1294
    grub_menu_init_page (0, 1, &screen->terms[i].num_entries,
 
1295
                         screen->terms[i].term);
1294
1296
  update_screen_all (screen, 0, 0, 1, 1, ALL_LINES);
1295
1297
  for (i = 0; i < screen->nterms; i++)
1296
1298
    grub_term_setcursor (screen->terms[i].term, 1);